MATLAB: Generate random number from a two-parameter exponential distribution

exponential distributionMATLABrandom number generatorStatistics and Machine Learning Toolbox

Hello everybody,
I am looking for a way to easily generate random numbers from a two-parameter exponential distribution. The probability density function is: . I am aware of expand() but it does not seem to include the two-parameter distribution.
Do you have any idea how I could achieve that?
Thank you very much.
Alexis

Best Answer

gam = ...;
lambda = ...;
n = 100;
x = gam - log(1-rand(n,1))/lambda
give you 100 random numbers distributed according to your two-parameter distribution.