RANDN

Purpose:

Generates a normally distributed random array.

Syntax:

RANDN(numrows, numcols, mean, std, unscale)

numrows

-

An integer. The number of output rows.

numcols

-

Optional. An integer, the number of output columns. Defaults to numrows.

mean

-

Optional. A real, the series mean. Defaults to 0.0.

std

-

Optional. A real, the series standard deviation. Defaults to 1.

unscale

-

Optional. An integer, the mean and standard deviation scaling flag.

0

:

Standard mode, scale the result to have the specified mean and standard deviation (default).

1

:

Raw mode, do not scale the result. The result will have approximately the specified mean and standard deviation.

RANDN with no input arguments returns a scalar.

Returns:

A scalar, series or array.

Example:

randn(20, 5)

 

Generates a 20 row by 5 column array of normally distributed random numbers. Each column has a mean of 0 and standard deviation of 1.

Example:

randn(20, 5, 10, 3)

 

Same as above except  each column has a mean of 10.0 and a standard deviation of 3.0.

Example:

randn(20, 5, 10, 3, 1)

 

Generates a 20 row by 5 column array of normally distributed random numbers from a population where the mean is 10.0 and the standard deviation is 3.0. Each column has a mean of approximately 10.0 and a standard deviation of approximately 3.0.

Example:

randn

 

Returns a single random real value chosen from a set of normally distributed random values with a mean of 0 and a standard deviation of 1.0.

Remarks:

RANDN uses GNORM to generate the random values. The SEEDRAND function determines the initial seed of the random number generator.

 

The resulting values are chosen from a population of normally distributed values with the specified mean and standard deviation. If unscale is 0, each column is scaled to have precisely the specified mean and standard deviation. If unscale is 1, the values are not scaled.

 

The default unscale mode can be set with the RANDN_MODE configuration parameter.

See Also:

GNORMAL

GRANDOM

RAND

SEEDRAND