Reference randomGaussian()

randomGaussian()

Returns a random number fitting a Gaussian, or normal, distribution.

Normal distributions look like bell curves when plotted. Values from a normal distribution cluster around a central value called the mean. The cluster's standard deviation describes its spread.

By default, randomGaussian() produces different results each time a sketch runs. The randomSeed() function can be used to generate the same sequence of numbers each time a sketch runs.

There's no minimum or maximum value that randomGaussian() might return. Values far from the mean are very unlikely and values near the mean are very likely.

The version of randomGaussian() with no parameters returns values with a mean of 0 and standard deviation of 1.

The version of randomGaussian() with one parameter interprets the argument passed as the mean. The standard deviation is 1.

The version of randomGaussian() with two parameters interprets the first argument passed as the mean and the second as the standard deviation.

Examples

Syntax

randomGaussian([mean], [sd])

Parameters

mean

mean.

sd

standard deviation.

Notice any errors or typos? Please let us know. Please feel free to edit src/math/random.js and open a pull request!

Related References