Created
February 2, 2018 15:11
-
-
Save eriadam/58ae6f82c9e47b286c8f103d819c3294 to your computer and use it in GitHub Desktop.
Basic examples of GKRandomDistribution
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
// Random number between 1 and 6 | |
let d6 = GKRandomDistribution.d6() | |
d6.nextInt() | |
// 20-sided die? Done. | |
let d20 = GKRandomDistribution.d20() | |
d20.nextInt() | |
// Random number between 5 and 10 | |
GKRandomDistribution( | |
lowestValue: 5, | |
highestValue: 10) | |
.nextInt() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment