laziness, impatience, and hubris | |
PerlMonks |
Re: Empty Elementsby MarkM (Curate) |
on Jun 09, 2003 at 04:47 UTC ( [id://264239]=note: print w/replies, xml ) | Need Help?? |
I believe you intended your second last line to read: $DECK[$_-1] = $i;Note, however, that your algorithm wastes valuable entropy, and is inefficient. Wasted entropy can reduce the effective period of a rand() function. The inner loop could also, in theory, loop indefinately (although for the expected scenario, it would loop 100 times or less).
In Section
Seekers of Perl Wisdom
|
|