Y = randn(n)Y = randn(m,n)Y = randn(size(A))randn('seed')randn('seed',n)randn
randn generates random numbers and matrices whose elements are normally distributed with mean 0 and variance 1.
randn(n) is an n-by-n matrix with random entries.
randn(m,n) is an m-by-n matrix with random entries.
randn(size(A)) is the same size as A and has random entries.
randn('seed') returns the current value of the seed used by the generator.
randn('seed',n) sets the seed to n. randn('seed',0) sets the seed to its startup value.
randn with no arguments is a scalar whose value changes each time it is referenced.
The functions rand and randn maintain separate generators with separate seeds.
randn has not yet been used during a particular MATLAB session, then R = randn(3,4) produces
For a histogram of theR =1.1650 0.3516 0.0591 0.87170.6268 -0.6965 1.7971 -1.44620.0751 1.6961 0.2641 -0.7012
randn distribution, see hist.
randn uses a second copy of the uniform generator used by rand and transforms the resulting values according to the algorithm in [1].
rand,randperm
(c) Copyright 1994 by The MathWorks, Inc.