I read in http://ift.tt/1oL2NxJ that the best way to generate a random number is to use
let r = arc4random_uniform(UInt32(_names.count))
let name : String = _names[Int(r)]
but it seems odd that I have to cast twice to be able to get a random number, what should I do to avoid casting?
Aucun commentaire:
Enregistrer un commentaire