Function File: r = random(name, arg1)
Function File: r = random(name, arg1, arg2)
Function File: r = random(name, arg1, arg2, arg3)
Function File: r = random(name, ..., s1, ...)

Generates pseudo-random numbers from a given one-, two-, or three-parameter distribution.

The variable name must be a string that names the distribution from which to sample. If this distribution is a one-parameter distribution arg1 should be supplied, if it is a two-paramter distribution arg2 must also be supplied, and if it is a three-parameter distribution arg3 must also be present. Any arguments following the distribution paramters will determine the size of the result.

As an example, the following code generates a 10 by 20 matrix containing random numbers from a normal distribution with mean 5 and standard deviation 2.

R = random("normal", 5, 2, [10, 20]);

The variable name can be one of the following strings

"beta"
"beta distribution"

Samples are drawn from the Beta distribution.

"bino"
"binomial"
"binomial distribution"

Samples are drawn from the Binomial distribution.

"chi2"
"chi-square"
"chi-square distribution"

Samples are drawn from the Chi-Square distribution.

"exp"
"exponential"
"exponential distribution"

Samples are drawn from the Exponential distribution.

"f"
"f distribution"

Samples are drawn from the F distribution.

"gam"
"gamma"
"gamma distribution"

Samples are drawn from the Gamma distribution.

"geo"
"geometric"
"geometric distribution"

Samples are drawn from the Geometric distribution.

"hyge"
"hypergeometric"
"hypergeometric distribution"

Samples are drawn from the Hypergeometric distribution.

"logn"
"lognormal"
"lognormal distribution"

Samples are drawn from the Log-Normal distribution.

"nbin"
"negative binomial"
"negative binomial distribution"

Samples are drawn from the Negative Binomial distribution.

"norm"
"normal"
"normal distribution"

Samples are drawn from the Normal distribution.

"poiss"
"poisson"
"poisson distribution"

Samples are drawn from the Poisson distribution.

"rayl"
"rayleigh"
"rayleigh distribution"

Samples are drawn from the Rayleigh distribution.

"t"
"t distribution"

Samples are drawn from the T distribution.

"unif"
"uniform"
"uniform distribution"

Samples are drawn from the Uniform distribution.

"unid"
"discrete uniform"
"discrete uniform distribution"

Samples are drawn from the Uniform Discrete distribution.

"wbl"
"weibull"
"weibull distribution"

Samples are drawn from the Weibull distribution.

See also: rand, betarnd, binornd, chi2rnd, exprnd, frnd, gamrnd, geornd, hygernd, lognrnd, nbinrnd, normrnd, poissrnd, raylrnd, trnd, unifrnd, unidrnd, wblrnd.

Package: statistics