MATLAB: Generate n random number between two numbers follow exponential distribution

exponential distributionrandomrandom numbers generator

I need to generate n random number between a and b which follow the exponential distribution (In this perticular case a=0, b=75, random number =t=occurance time; I need exactly "n=60" random numbers of "t" which are less than 75). here is what I have done:
mu=475; % return period
lambda=1/mu; % occurance rate
u=rand(100,1); % uniform random numbers between 0 and 1
t=icdf('Exponential',u,mu); % exponential random numbers of time

Best Answer

I would use the Statistics and Machine Learning Toolbox exprnd (link) function.
Experiment to get the result you want.