Skip to content

Instantly share code, notes, and snippets.

@jweinst1
Created July 14, 2015 00:52
Show Gist options
  • Save jweinst1/2d5cbb08673340e111e4 to your computer and use it in GitHub Desktop.
Save jweinst1/2d5cbb08673340e111e4 to your computer and use it in GitHub Desktop.
Swift Method of selecting a random element from an array
let arras = ["Frodo", "sam", "wise", "gamgee"]
let randomIndex = Int(arc4random_uniform(UInt32(arras.count)))
var one = arras[randomIndex]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment