<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameplayKit",
  "identifier" : "/documentation/GameplayKit/GKGaussianDistribution/init(randomSource:lowestValue:highestValue:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "GameplayKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKGaussianDistribution(im)initWithRandomSource:lowestValue:highestValue:"
  },
  "title" : "init(randomSource:lowestValue:highestValue:)"
}
-->

# init(randomSource:lowestValue:highestValue:)

Initializes a Gaussian random distribution with the specified lower and upper bounds, using the specified source randomizer.

```
init(randomSource source: any GKRandom, lowestValue lowestInclusive: Int, highestValue highestInclusive: Int)
```

## Parameters

`source`

A randomizer that produces raw random values for use by the distribution. A randomizer is any object implementing the [`GKRandom`](/documentation/GameplayKit/GKRandom) protocol, which can be a random source algorithm such as the [`GKARC4RandomSource`](/documentation/GameplayKit/GKARC4RandomSource) class or another random distribution.

`lowestInclusive`

The lowest value to be produced by the distribution.

`highestInclusive`

The highest value to be produced by the distribution.

## Return Value

A new random distribution.

## Discussion

Using this initializer creates a Gaussian distribution centered within the specified range. The [`mean`](/documentation/GameplayKit/GKGaussianDistribution/mean) property is set to the midpoint between the `lowestInclusive` and `highestInclusive` parameters (`mean = (highest + lowest) / 2`), and the [`deviation`](/documentation/GameplayKit/GKGaussianDistribution/deviation) property is set such that the highest and lowest values are each three deviations away from the mean (`deviation = (highest - lowest) / 6`). The [`mean`](/documentation/GameplayKit/GKGaussianDistribution/mean) and [`deviation`](/documentation/GameplayKit/GKGaussianDistribution/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.

For more information, see [GameplayKit Programming Guide](https://developer.apple.com/library/archive/documentation/General/Conceptual/GameplayKit_Guide/index.html#//apple_ref/doc/uid/TP40015172).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)