| Statistics Toolbox | Search  Help Desk |
| random | Examples |
Random numbers from a specified distribution.
Syntax
y = random('name',A1,A2,A3,m,n)
Description
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. y = random('name',A1,A2,A3,m,n) returns a matrix of random numbers. 'name' is a string containing the name of the distribution. A1, A2, and A3 are matrices of distribution parameters. Depending on the distribution some of the parameters may not be necessary. The arguments containing distribution parameters must all be the same size except that scalar arguments function as constant matrices of the common size of the other arguments. 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).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