Random number generation

arc4random_uniform(someNumber: UInt32) -> UInt32

This gives you random integers in the range 0 to someNumber – 1.

The maximum value for UInt32 is 4,294,967,295.

let day = arc4random_uniform(31) + 1 // 1...31
let year = 2010 + arc4random_uniform(10) // random year

Leave a Reply

Your email address will not be published. Required fields are marked *