Guest User

Untitled

a guest
Jun 25th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. value = arc4random() % x
  2.  
  3. val = arc4random() % y;
  4. while(val >= x)
  5. val = arc4random() % y;
  6.  
  7. u_int32_t maxValue = ~((u_int32_t) 0); // equal to 0xffff...
  8. maxValue -= maxValue % x; // make maxValue a multiple of x
  9. while((value = arc4random()) >= maxValue) { // loop until we get 0 ≤ value < maxValue
  10. }
  11. value %= x;
  12.  
  13. arc4random
  14.  
  15. u_int32_t maxValue = ~((u_int32_t) 0); // equal to 0xffff...
  16. maxValue -= maxValue % x; // make maxValue a multiple of x
  17. while((value = arc4random()) >= maxValue) { // loop until we get 0 ≤ value < maxValue
  18. }
  19. value %= x;
Add Comment
Please, Sign In to add comment