Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- value = arc4random() % x
- val = arc4random() % y;
- while(val >= x)
- val = arc4random() % y;
- u_int32_t maxValue = ~((u_int32_t) 0); // equal to 0xffff...
- maxValue -= maxValue % x; // make maxValue a multiple of x
- while((value = arc4random()) >= maxValue) { // loop until we get 0 ≤ value < maxValue
- }
- value %= x;
- arc4random
- u_int32_t maxValue = ~((u_int32_t) 0); // equal to 0xffff...
- maxValue -= maxValue % x; // make maxValue a multiple of x
- while((value = arc4random()) >= maxValue) { // loop until we get 0 ≤ value < maxValue
- }
- value %= x;
Add Comment
Please, Sign In to add comment