GKGaussianDistribution
A generator for random numbers that follow a Gaussian distribution (also known as a normal distribution) across multiple samplings.
Declaration
class GKGaussianDistributionOverview
[Image]
In a Gaussian distribution, random samplings are most likely to result in a value near the center of the distribution, and have reduced probability of producing higher or lower values. To generate random numbers with a Gaussian distribution, use the methods defined by its superclass GKRandomDistribution.
A Gaussian distribution is characterized by its mean and deviation properties. The mean value (also called the median or expected value) is the value at the center of the distribution (halfway between its lowestValue and highestValue properties), and the most likely value to result from a random sampling. The farther any other value is from the mean, the less likely that value is to result from a random sampling. The deviation value (also called standard deviation or sigma) characterizes those probabilities: 68.27% of values generated by the distribution are within one deviation of the mean, 95% of generated values are within two deviations, and 100% of generated values are within three deviations.
Gaussian distributions appear in many natural phenomena that you might model in a game. For example, the following code creates a distribution whose random number generation is equivalent to rolling three six-sided dice (also called 3d6) and summing the results.
For more information on choosing and using randomizers in GameplayKit, read Randomization in GameplayKit Programming Guide.