Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^3: About List::Util's pure Perl shuffle()

by BrowserUk (Pope)
on Jul 12, 2007 at 00:32 UTC ( #626117=note: print w/replies, xml ) Need Help??

in reply to Re^2: About List::Util's pure Perl shuffle()
in thread About List::Util's pure Perl shuffle()

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 ], @_; }

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://626117]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2016-10-22 08:19 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (294 votes). Check out past polls.