Help for this page

Select Code to Download


  1. or download this
        my @array = qw /one two three four five six/;
        for (my $i = @array; -- $i;) {
            my $r = int rand (1 + $i);
            @array [$i, $r] = @array [$r, $i] unless $r == $i;
        }
    
  2. or download this
    use Algorithm::Numerical::Shuffle qw/shuffle/;
    my @array = shuffle qw/one two three four five/;