Here's a non-aliasing version that does work, but it doesn't perform very well. Why it works is left as an exercise.
sub bukNoAlias (@) { my @a = @_; my( $n, $t ); my $i = @_; map+( $t=$a[ $n=rand($i--) ], $a[ $n ]=$a[ $i ] )[ 0 ], @_; }
In reply to Re^3: About List::Util's pure Perl shuffle()
by BrowserUk
in thread About List::Util's pure Perl shuffle()
by blazar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |