Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Re: Re^2: When the Best Solution Isn't

by diotalevi (Canon)
on Sep 23, 2002 at 13:18 UTC ( #200086=note: print w/replies, xml ) Need Help??

in reply to Re: Re^2: When the Best Solution Isn't
in thread When the Best Solution Isn't

There was a recent thread on the ActiveState list which was never quite solved. In general it came down to assigning to @_ was causing some weirdness to occur and ActiveState perl 5.6.1 would slow down to a crawl after a few thousand iterations. Other perls like my OpenBSD 5.6.1 and Cygwin 5.8.0 behaved nicely.

I'm not sure what the issue was but there may be lurking bug in assigning to @_. I'm warning against it. (or at least be aware so if you do run into trouble later...)

Update: fixed some spelling

  • Comment on Re: Re: Re^2: When the Best Solution Isn't

Replies are listed 'Best First'.
Re: Re: Re: Re^2: When the Best Solution Isn't
by japhy (Canon) on Sep 23, 2002 at 14:12 UTC
    Don't fret -- an equally speedy solution is thus:
    sub shuffle (\@) { my $d = shift; my @r = map rand, 0 .. $#$d; @$d[sort { $r[$a] <=> $r[$b] } 0 .. $#$d] = @$d; }
    It requires you send it an actual array, of course, but it is just as fast.

    Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2020-08-04 11:36 GMT
Find Nodes?
    Voting Booth?
    Which rocket would you take to Mars?

    Results (33 votes). Check out past polls.