List::Util's shuffle is a little faster still. Adding:
my $sub3 = sub { shuffle (@randomarray); };
and changing timethese to cmpthese (with other changes as required) gives:
Rate Sub 2 Sub 1 Sub 32 Sub 2 14869/s -- -13% -89% Sub 1 17066/s 15% -- -87% Sub 32 131573/s 785% 671% --
In reply to Re: Array Shuffle
by GrandFather
in thread Array Shuffle
by logie17
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |