Statistics Toolbox | ![]() ![]() |
Random numbers from a specified distribution
Syntax
Description
y = random('name',A1,A2,A3,m,n)
returns a matrix of random numbers, where 'name'
is a string containing the name of the distribution, and A1, A2, and A3 are matrices of distribution parameters. Depending on the distribution some of the parameters may not be necessary.
Vector or matrix inputs must all have the same size. A scalar input is expanded to a constant matrix with the same dimensions as the other inputs.
The last two parameters, d and e, are the size of the matrix y
. If the distribution parameters are matrices, then these parameters are optional, but they must match the size of the other matrix arguments (see second example).
random is a utility routine allowing you to access all the random number generators in the Statistics Toolbox using the name of the distribution as a parameter. See Overview of the Distributions for the list of available distributions.
Examples
rn = random('Normal',0,1,2,4) rn = 1.1650 0.0751 -0.6965 0.0591 0.6268 0.3516 1.6961 1.7971 rp = random('Poisson',1:6,1,6) rp = 0 0 1 2 5 7
See Also
betarnd
, binornd
, cdf
, chi2rnd
, exprnd
, frnd
, gamrnd
, geornd
, hygernd
, icdf
, lognrnd
, nbinrnd
, ncfrnd
, nctrnd
, ncx2rnd
, normrnd
, pdf
, poissrnd
, raylrnd
, trnd
, unidrnd
, unifrnd
, weibrnd
![]() | qqplot | randtool | ![]() |