Help for this page

Select Code to Download


  1. or download this
    sub naive (@) {
        for (reverse 1..$#_) {
    ...
            @_[$_,$r]=@_[$r,$_];
        }
    }
    
  2. or download this
    sub bzr (@) {
        my @a = 0..$#_;
    ...
        my $n;
        map +($_[$a[$n=rand($i--)]], $a[$n]=$a[$i])[0], @_;
    }
    
  3. or download this
            my $x = $l[$r];
            $l[$r] = $l[$_];
            $l[$_] = $x;
    
  4. or download this
    sub naive2 (@) {
        my @l=@_;
    ...
        }
        @l2;
    }