What is the best way to generate a random integer with a restricted set of digits?
I want to generate a 4 digit random number, where each digit is in the range [1..6]. I was thinking generate a number in the range [0..1295], then converting to base 6 and incrementing the digits, but that goes through a string.
Aucun commentaire:
Enregistrer un commentaire