<< rand random rng >>

randn


Normally distributed random number.


Syntax


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)

Input argument


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

Output argument


M

a matrix of random numbers.

Description


randn returns a matrix with normally distributed random elements having zero mean and variance one.

By default, randn uses the ziggurat algorithm implemented by Boost.

seed can be modified using rng.

Examples


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)

See also


rng, randn, eye.

History


Version Description
1.0.0 initial version

Author


Allan CORNET

<< rand random rng >>