randn
Standard-normal random numbers (mean 0, variance 1).
Syntax
Section titled “Syntax”r = randnr = randn(n)r = randn(m, n)r = randn(d1, d2, ...)Description
Section titled “Description”Returns pseudorandom values drawn from the standard normal distribution N(0, 1). Same shape arguments as rand. For other normal distributions, scale and shift: mu + sigma * randn(…).
Examples
Section titled “Examples”randn % e.g. -0.7283randn(1000, 1) % 1000-sample column5 + 2 * randn(100, 1) % N(5, 4) samples