function [eps] = generate_noise_vector(n, type, param)

    % inputs:
    % n: number of i.i.d. noise instances
    % type: type of distribution
    % param: parameter for distribution
    % for bern: this is p
    % for t: this is \nu (degrees of freedom)
    % output:
    % eps: a vector n noise instances
    % scaling: each entry has mean 0 and variance 1
    
    if strcmp(type, 'gau')
        eps = randn(n, 1);
    end
    
    if strcmp(type, 'bern')
        eps = (binornd(1, param, [n 1]) - param) ...
            / sqrt( param * (1 - param) );
    end
    
    if strcmp(type, 't')
        eps = trnd(param, [n 1]) ...
            / sqrt( param / (param - 2) );
    end
        
end