Help for this page

Select Code to Download


  1. or download this
    sub fisher_yates_shuffle {
        my $deck = shift;  # $deck is a reference to an array
    ...
            @$deck[$i,$j] = @$deck[$j,$i];
        }
    }
    
  2. or download this
    sub fixed_fisher_yates_shuffle {
        my ($deck, $rand) = @_;
    ...
    foreach my $key (sort keys %count) {
        print $key, " = ", $count{$key}, "\n";
    };