|
|
| XP is just a number | |
| PerlMonks |
Re^3: Is there a better way to generate unique set of random numbers ?by moritz (Cardinal) |
| on Jul 28, 2011 at 10:02 UTC ( [id://917236]=note: print w/replies, xml ) | Need Help?? |
|
%seen is a hash. If the key $candidate is not present in the hash, it is added to the hash (that's called "autovivification"), initialized to 1, and undef is returned - the redo is not executed.
On the other hand if the key is already present in the hash, the corresponding value (for example 1) is returned, and incremented by one (for example set to 2). In this case the interesting part is not the incrementing, but that it returns a true value, so the redo is executed.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||