MATLAB: Generating random number for the Inverse Gaussian distribution

random number generatorstatistics

what is the code for generating random number for the inverse Gaussian distribution?
Please post here if anyone known of a good method of doing this.

Best Answer

If you have the Statistics and Machine Learning Toolbox, then you can generate N random numbers with
N = 1000; % Set this to the number of values you want
mu = 1; % Set the scale parameter
lambda = 1; % Set the shape parameter
r = random('InverseGaussian',mu,lambda,N,1);