Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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.

Comment on Re^3: About List::Util's pure Perl shuffle()
Download Code

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 imbibing at the Monastery: (1)
As of 2015-10-10 00:42 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (254 votes), past polls