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