---
title: GKGaussianDistribution
framework: gameplaykit
role: symbol
role_heading: Class
path: gameplaykit/gkgaussiandistribution
---

# GKGaussianDistribution

A generator for random numbers that follow a Gaussian distribution (also known as a normal distribution) across multiple samplings.

## Declaration

```swift
class GKGaussianDistribution
```

## Overview

Overview important: The randomization services provided in GameplayKit are suitable for reliably creating deterministic, pseudorandom gameplay mechanics, but are not cryptographically robust. For cryptography, obfuscation, or cipher uses, use the Security framework, described in Cryptographic Services Guide.

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. note: In the standard mathematical model of a Gaussian distribution, 99.7% of generated values are within three deviations of the mean and the distribution’s range is infinite. GameplayKit discards the extremely unlikely values more than three deviations from the mean in order to set finite limits on the distribution’s range. 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.

## Topics

### Creating a Random Distribution

- [init(randomSource:lowestValue:highestValue:)](gameplaykit/gkgaussiandistribution/init(randomsource:lowestvalue:highestvalue:).md)
- [init(randomSource:mean:deviation:)](gameplaykit/gkgaussiandistribution/init(randomsource:mean:deviation:).md)

### Working with Characteristics of a Distribution

- [mean](gameplaykit/gkgaussiandistribution/mean.md)
- [deviation](gameplaykit/gkgaussiandistribution/deviation.md)

## Relationships

### Inherits From

- [GKRandomDistribution](gameplaykit/gkrandomdistribution.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [GKRandom](gameplaykit/gkrandom.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Randomization

- [GKRandom](gameplaykit/gkrandom.md)
- [GKRandomSource](gameplaykit/gkrandomsource.md)
- [GKARC4RandomSource](gameplaykit/gkarc4randomsource.md)
- [GKLinearCongruentialRandomSource](gameplaykit/gklinearcongruentialrandomsource.md)
- [GKMersenneTwisterRandomSource](gameplaykit/gkmersennetwisterrandomsource.md)
- [GKRandomDistribution](gameplaykit/gkrandomdistribution.md)
- [GKShuffledDistribution](gameplaykit/gkshuffleddistribution.md)
