Basic Random Integer

suggest change

The arc4random_uniform() function is the simplest way to get high-quality random integers. As per the manual:

arc4random_uniform(upper_bound) will return a uniformly distributed random number less than upper_bound.

arc4random_uniform() is recommended over constructions like ’‘arc4random() % upper_bound’’ as it avoids “modulo bias” when the upper bound is not a power of two.

uint32_t randomInteger = arc4random_uniform(5); // A random integer between 0 and 4

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Random numbers:
*Basic Random Integer

Table Of Contents