I prefer japhy's one-liner, which achieves shuffling via fisher-yates:
@entry[-$i,$j] = @entry[$j,-$i] while $j = rand(@entry - $i), ++$i < @
+entry;
as an aside - this is in the snippets section. would it not be nice to use snippets, or grinder's fabled categorized snippets library, as a source of data for categorized q&a?
ttfn,
...wufnik
-- in the world of the mules there are no rules --
| [reply] [d/l] |
my @data = 0..51;
my @cards = sort { (-1,1)[rand(2)] } @data ;
Graciliano M. P.
"The creativity is the expression of the liberty". | [reply] [d/l] |
use Math::Random::MT::Auto 'shuffle';
my @cards = 0..51;
shuffle(\@cards);
Remember: There's always one more bug.
| [reply] [d/l] [select] |