There are algorithms to generate random numbers like:
number = (previous_number * constant + other_constant) mod third_constant
for carefully selected constants. But I need algorithm to generate random integers that are in range of 0 to n-1. (Obviously not running loop and getting the counter, I need randomness). How is this possible? Thank you.
Aucun commentaire:
Enregistrer un commentaire