I need to generate a random number between 1 and 52, for a card game (I know how to).
I could either use random (52)
to directly reference each card in the pack, or I could do random(4)
and random(13)
to get the Suit and Value separately.
I can get the suit and value from the number between 1 and 52 with r div 13
and r mod 13 + 1
.
But I am wondering if generating two random numbers will affect the "randomness" of the outcome. As the numbers generates will be pseudo random numbers, so that could affect it in some way?
And if the low numbers 4 and 13 vs 52 don't make a difference, is there a value where this could become an issue?
Aucun commentaire:
Enregistrer un commentaire