Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Randomly select values from array

by ikegami (Patriarch)
on May 16, 2010 at 17:06 UTC ( [id://840240]=note: print w/replies, xml ) Need Help??


in reply to Re: Randomly select values from array
in thread Randomly select values from array

@data = sort {rand < rand} @data;
is not guaranteed to work, much less return something random. Use List::Util's shuffle instead.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2025-07-11 08:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.