Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

When the Best Solution Isn't

by sauoq (Abbot)
on Sep 23, 2002 at 01:00 UTC ( [id://199981]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    @random = sort { .5 <=> rand(1) } @array;    # DO NOT USE THIS!
    
  2. or download this
    $ perl -le '@n=(1..3);for(1..100000){@m=sort{.5<=>rand}@n;$h{"@m"}++}f
    +or(sort{$h{$b}<=>$h{$a}}keys%h){print"$_: $h{$_}"}'
    1 2 3: 24990
    ...
    1 3 2: 12541
    3 1 2: 12514
    3 2 1: 12491
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://199981]
Approved by rob_au
Front-paged by gmax
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-03-28 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found