Initializes a Gaussian random distribution with the specified lower and upper bounds, using the specified source randomizer.
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
The lowest value to be produced by the distribution.
The highest value to be produced by the distribution.
A new random distribution.
Using this initializer creates a Gaussian distribution centered within the specified range. The
mean property is set to the midpoint between the
highest parameters (
mean = (highest + lowest) / 2), and the
deviation property is set such that the highest and lowest values are each three deviations away from the mean (
deviation = (highest - lowest) / 6). The
deviation properties can thus be floating-point values even if you use the distribution only to produce integers.
A random distribution works by mapping the values produced by the
source randomizer to the range and characteristics specified by the distribution. Multiple distributions can share the same source, with the side effect that retrieving a random value through one distribution affects the sequence of random numbers produced by the source.