Skip to content

Instantly share code, notes, and snippets.

@MartinJNash
Created April 26, 2015 10:08
Show Gist options
  • Save MartinJNash/6be73df9d73fde6917e9 to your computer and use it in GitHub Desktop.
Save MartinJNash/6be73df9d73fde6917e9 to your computer and use it in GitHub Desktop.
func randBetween(range: Range<Int>) -> Int {
let num = arc4random_uniform(UInt32(range.endIndex + 1))
return Int(num) + range.startIndex
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment