You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Timothy Lee edited this page Jul 29, 2014
·
1 revision
Overview
If you want to generate a random number, use the arc4random_uniform method. Here are a few examples of how you use it:
// To generate a random number between 0 and 9
x = arc4random_uniform(10);
// To generate a number from 100 to 199
x = arc4random_uniform(100) + 100;
// To generate a number from -10 to 10
x = arc4random_uniform(21) - 10;