Help for this page

Select Code to Download


  1. or download this
    for (my $i = @list; -- $i;) {
        my $r = int rand (1 + $i);
        @list [$i, $r] = @list [$r, $i] unless $r == $i;
    }
    
  2. or download this
    @list = map { $_->[0] } 
    sort { $a->[1] <=> $b->[1] } 
    map { [ $_, rand(1024) ] } @list;