Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://626117]
help
Chatterbox?
[1nickt]: Wow, sometimes "Perl programming" hardly involves Perl! I just spent a couple of days implementing some features in the CPAN Testers API and it was 90% hand-editing JSON Swagger config and test data structs, and writing doc. Maybe that's just the sign of
[Discipulus]: rethatching? a real, old cottage?
[1nickt]: ... a well-crafted project that's easy to extend.
[1nickt]: Discipulus I believe virtualsue *is* that fortunate. @10:42Z yesterday "my view this morning is of a chap stuffing straw in my roof" ...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2017-11-21 11:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (297 votes). Check out past polls.

    Notices?