If you have the Statistics toolbox:
To generate random samples with a Beta ditribution:
samples = betarnd(a,b,m,n); %// parameters: a, b; sample size m x n
To generate random samples with a Gamma ditribution:
samples = gamrnd(a,b,m,n); %// parameters: a, b; sample size m x n
To generate random samples with a Poisson ditribution:
samples = poissrnd(l,m,n); %// parameter: l; sample size m x n
Note that the parameters of these distributions are not necessarily mean and variance. You will have to do a computation of the required parameters to achieve your desired mean and variance. In some cases, such as the Poisson distribution, there is only one parameter, so you can't specify mean and variance simultaneously.
For other distributions: type help stats
. My version of the Statistics toolbox includes:
Random Number Generators.
betarnd - Beta random numbers.
binornd - Binomial random numbers.
chi2rnd - Chi square random numbers.
evrnd - Extreme value random numbers.
exprnd - Exponential random numbers.
frnd - F random numbers.
gamrnd - Gamma random numbers.
geornd - Geometric random numbers.
gevrnd - Generalized extreme value random numbers.
gprnd - Generalized Pareto inverse random numbers.
hygernd - Hypergeometric random numbers.
iwishrnd - Inverse Wishart random matrix.
johnsrnd - Random numbers from the Johnson system of distributions.
lognrnd - Lognormal random numbers.
mhsample - Metropolis-Hastings algorithm.
mnrnd - Multinomial random vectors.
mvnrnd - Multivariate normal random vectors.
mvtrnd - Multivariate t random vectors.
nbinrnd - Negative binomial random numbers.
ncfrnd - Noncentral F random numbers.
nctrnd - Noncentral t random numbers.
ncx2rnd - Noncentral Chi-square random numbers.
normrnd - Normal (Gaussian) random numbers.
pearsrnd - Random numbers from the Pearson system of distributions.
poissrnd - Poisson random numbers.
randg - Gamma random numbers (unit scale).
random - Random numbers from specified distribution.
randsample - Random sample from finite population.
raylrnd - Rayleigh random numbers.
slicesample - Slice sampling method.
trnd - T random numbers.
unidrnd - Discrete uniform random numbers.
unifrnd - Uniform random numbers.
wblrnd - Weibull random numbers.
wishrnd - Wishart random matrix.