Created
July 14, 2015 00:52
-
-
Save jweinst1/2d5cbb08673340e111e4 to your computer and use it in GitHub Desktop.
Swift Method of selecting a random element from an array
This file contains 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
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