Skip to content

randn

Standard-normal random numbers (mean 0, variance 1).

r = randn
r = randn(n)
r = randn(m, n)
r = randn(d1, d2, ...)

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(…).

randn % e.g. -0.7283
randn(1000, 1) % 1000-sample column
5 + 2 * randn(100, 1) % N(5, 4) samples
  • rand — Uniformly distributed random numbers in [0, 1].
  • randi — Uniformly distributed random integers.