Normal law (column vector).


Prototype

static Vecf randn(int n)

Parameters

nNumber of points to generate.

Returns

Random vector.

Description

Generation of a samples vector for a normal law ( \(\mathcal{N}(0,1)\)).

Note
Note that so as to generate a more general Gaussian law (variance not unitary, and / or mean not null), one has just to scale the result of a normal law. For instance, for a mean of 5, and a variance of \(1/2\) :

let x = 5 + 0.5 * randn(n);



Example

  // 100 valeurs aléatoires (loi normale)
  soit x = randn(1000);

  Figure f;
  f.plot(x, "yo");

See also

randu(int, float, float), randb()