Help for this page

Select Code to Download


  1. or download this
        for( 0 .. $#$ref ) {
            my $p = $_ + rand( $n-- );
            @{$ref}[$p,$_] = @{$ref}[$_,$p];
        }
    
  2. or download this
    sub my_shuffle2 {
        my $ref = \@_;
    ...
        return unless defined wantarray;
        return wantarray ? @{ $ref } : $ref;
    }