I\'m just starting to learn swift. I\'m attempting to create an array of several random numbers, and eventually sort the array. I\'m able to create an array of one random number
Ok, this is copy/paste of a question asked elsewhere, but I think I'll try to remember that one-liner :
var randomArray = map(1...100){_ in arc4random()}
(I love it !)
EDIT
If you need a random number with an upperBound (exclusive), use arc4random_uniform(upperBound)
e.g. : random number between 0 & 99 : arc4random_uniform(100)
Swift 2 update
var randomArray = (1...100).map{_ in arc4random()}