jeudi 12 janvier 2017

Scaling down a 32-bit random value

What is the correct way to scale down a random 32-bit integer to a value within [m, n) or [0, n-m) interval without biasing the outcome in the long run (for tens of millions of values)?

Code samples in Java would be appreciated but not necessary. :)




Aucun commentaire:

Enregistrer un commentaire