![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re(3): Generating random 6 digit numbersby Arien (Pilgrim) |
on Aug 25, 2002 at 18:04 UTC ( [id://192702]=note: print w/replies, xml ) | Need Help?? |
Sure, that makes sense. In that case uniqueness seems to be of greater importance than true randomness: you just don't want the numbers to be easily guessable, correct? One solution is to shuffle the numbers in this range and pop or shift one every time, as sauoq mentions above. If this solution is desirable or not depends on what you are trying to achieve. How many numbers of those in your range will you issue? How hard do you want to make "guessing" a correct number? What are the consequences of "guessing" a valid number? These are some things to keep in mind. — Arien
In Section
Seekers of Perl Wisdom
|
|