Generates a normally distributed random series.
GNORMAL(length, spacing, mean, std, unscale)
length 
 
An integer, the length of the output series. 

spacing 
 
A real, the spacing (delta x) between points. 

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

std 
 
Optional. A real, the series standard deviation where 

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

A series.
gnormal(100, 0.01, 2.0, 3.0)
creates a 100 point, normally distributed random series of values from a population where the mean is 2.0 and the standard deviation is 3.0. The result is scaled to have an exact mean of 2.0 and an exact standard deviation of 3.0.
gnormal(100, 0.01, 2.0, 3.0, 1)
creates a 100 point, normally distributed random series of values from a population where the mean is 2.0 and the standard deviation is 3.0. The result has a mean of approximately 2.0 and a standard deviation of approximately 3.0.
gnormal(100, 0.01)
creates a 100 point, normally distributed random series with a mean of 0.0 and standard deviation of 1.0.
W1: gnormal(5000, 1, 1, 3);label("Random Gaussian")
W2: hist(w1, 50, "pdf");label("Histogram")
W3: pdfnorm(xvals(W2), 1, 3);lines;overp(W2, lred);label("Pdfnorm")
W1 contains 50000 samples of normally distributed random values with a mean of
W2 contains a 50 sample normalized histogram of W1.
W3 compares the distribution of the generated normally distributed random series to the analytic distribution with a mean of
GNORMAL uses the polar modification of the
If unscale is 0, the result is scaled to have precisely the specified mean and standard deviation. If unscale is 1, the values are not scaled and the resulting series will have approximately the specified mean and standard deviation.
The default unscale mode can be set with the RANDN_MODE configuration parameter.
The probability density function, f(x), for normally distributed random values is:
where μ is the mean, σ is the standard deviation and σ^{2} is the variance. The cumulative distribution function,
where erf(x) is the error function implemented by ERF.
See PDFNORM to compute the probability density function and PROBN to compute the cumulative distribution function.
Approximately 68% of the values from a normal distribution are within one standard deviation away from the mean. Approximately 95% of the values lie within two standard deviations and approximately 99.7% are within three standard deviations. This is known as the 3sigma rule.
See SEEDRAND to set a new seed value for the pseudorandom sequence.
GNORMAL can be abbreviated GNORM.