Last active
January 28, 2021 11:13
-
-
Save retrokid/aba0c3aa4e3094d6ebd21a5e7916f1d4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import GameplayKit | |
// seed must be between: 0 - 184467440737095551615 | |
var sourceTwister = GKMersenneTwisterRandomSource(seed: 7261500727393574700) | |
// it's static seed meaning the same numbers will be produced | |
sourceTwister.seed | |
// random numbers will be produced | |
var distrRandom = GKRandomDistribution(randomSource: sourceTwister, lowestValue: 1, highestValue: 3) | |
distrRandom.nextInt() | |
distrRandom.nextInt() | |
distrRandom.nextInt() | |
distrRandom.nextInt() | |
distrRandom.nextInt() | |
distrRandom.nextInt() | |
distrRandom.nextInt() | |
distrRandom.nextInt() | |
distrRandom.nextInt() | |
distrRandom.nextInt() | |
distrRandom.nextInt() | |
distrRandom.nextInt() | |
distrRandom.nextInt() | |
distrRandom.nextInt() | |
distrRandom.nextInt() | |
distrRandom.nextInt() | |
// most likely 2 will be produced | |
var distrGauss = GKGaussianDistribution(randomSource: sourceTwister, lowestValue: 1, highestValue: 3) | |
distrGauss.mean | |
distrGauss.deviation | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
distrGauss.nextInt() | |
// every number between 1 - 6 will be produced then it will repeat this process | |
var distrShuff = GKShuffledDistribution(randomSource: sourceTwister, lowestValue: 1, highestValue: 6) | |
distrShuff.nextInt() | |
distrShuff.nextInt() | |
distrShuff.nextInt() | |
distrShuff.nextInt() | |
distrShuff.nextInt() | |
distrShuff.nextInt() | |
distrShuff.nextInt() | |
distrShuff.nextInt() | |
distrShuff.nextInt() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment