Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
There's more than one way to do things
 
PerlMonks  

poor man's shuffle :)

by LanX (Abbot)
on Mar 27, 2013 at 19:38 UTC ( #1025797=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      DB<228> sort { (-1)**(rand(2)%2)  } 1..10
     => (5, 8, 7, 6, 9, 10, 1, 4, 2, 3)
    
  2. or download this
      DB<483> for (1..100000) {$x=0;$g[$x++]{$_}++ for sort {(-1) ** int r
    +and 2} a..d }
     => ""
    ...
      { a => 24773, b => 24944, c => 25203, d => 25080 },
      { a => 24863, b => 25103, c => 25172, d => 24862 },
    ]
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-04-23 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (555 votes), past polls