M = randn
M = randn(n)
M = randn(x1, x2, ... , xN)
M = randn(sz)
M = randn(x1, x2, ... , xN, classname)
M = randn(x1, x2, ... , xN, 'like', var)
| Parameter | Description |
|---|---|
| n | a variable: n-by-n matrix will be generated. |
| x1, x2, ... , xN | x1-by-...-by-xN values |
| classname | a string: 'single' or 'double' |
| var | a variable: single or double |
| Parameter | Description |
|---|---|
| M | a matrix of random numbers. |
randn returns a matrix with normally distributed random elements having zero mean and variance one.
By default, randn uses the ziggurat algorithm.
seed can be modified using rng.
rng('default');
randn
rng('default');
randn
rng('default');
randn(6)
rng('default');
randn(3, 2, 3)
rng('default');
randn(3, 2, 'single')
rng('default');
v = single([3, 3]);
randn(3, 2, 'like', v)
| Version | Description |
|---|---|
| 1.0.0 | initial version |
| 1.15.0 | Algo reworked |