Created
March 26, 2016 04:20
-
-
Save klgraham/b643026b17d096b669c1 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
func nextInt(min min: Int, max: Int) -> ((Void) -> Int) { | |
assert(max > min) | |
return { () in return Int(arc4random_uniform(UInt32((max - min) + 1))) + min } | |
} | |
let die6 = Distribution<Int>(get: nextInt(min: 1, max: 6)) | |
die6.sample(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment