Skip to content

Instantly share code, notes, and snippets.

@eriadam
Created February 2, 2018 15:11
Show Gist options
  • Save eriadam/58ae6f82c9e47b286c8f103d819c3294 to your computer and use it in GitHub Desktop.
Save eriadam/58ae6f82c9e47b286c8f103d819c3294 to your computer and use it in GitHub Desktop.
Basic examples of GKRandomDistribution
// 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