dopey has asked for the wisdom of the Perl Monks concerning the following question:
But now I'm getting a bunch of empty elements in $DECK. Why?foreach(1..100){ do{$i = rand(99)}while exists($seen{$i}); $seen{$i} = 1; $DECK[$i] = $1; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Fisher-Yates Shuffle (was Re: Empty Element)
by Arguile (Hermit) on Jun 09, 2003 at 05:07 UTC | |
Re: Empty Elements
by chromatic (Archbishop) on Jun 09, 2003 at 04:37 UTC | |
Re: Empty Elements
by MarkM (Curate) on Jun 09, 2003 at 04:47 UTC | |
Re: Empty Elements
by adrianh (Chancellor) on Jun 09, 2003 at 08:21 UTC | |
Re: Empty Elements
by dopey (Sexton) on Jun 09, 2003 at 05:45 UTC |