# iOS: Random Number Generation

Use the arc4random function to generate random numbers in a range. Suppose you have to generate a random number from 0 to 99. Do: int randomNum0to99 = arc4random() % 100; Or: int randomNum0to99 = arc4random_uniform(100); Between the 2 codes, the latter is preferred because: arc4random_uniform() will return a uniformly distributed random number less than upper_bound.… Read More iOS: Random Number Generation