nextGaussian

fun Random.nextGaussian(mean: Double = 0.0, standardDeviation: Double = 1.0): Double

Returns a normally distributed value with the given mean and standardDeviation.

The value is produced with the Box-Muller transform, so results follow a Gaussian distribution. A standardDeviation of 0.0 always yields mean.

Parameters

mean

the center of the distribution, 0.0 by default.

standardDeviation

the spread of the distribution, 1.0 by default, must be non-negative.

Throws