- Improved lib/Games/ABC_Path/Generator.pm with acknowldgements, a
"SEE ALSO" section and a "DESCRIPTION" section.
+ - Add the shuffle method to lib/Games/ABC_Path/MicrosoftRand.pm .
0.0.1 Thu Jul 21 19:02:11 IDT 2011
- First version, released on an unsuspecting world.
return ($self->rand() % $max);
+ my ($self, $deck) = @_;
+ return unless @$deck; # must not be empty!
+ my $j = $self->max_rand($i+1);
+ @$deck[$i,$j] = @$deck[$j,$i];
Can be used to re-assign the seed of the randomizer (though not recommended).
+=head2 my $array_ref = $randomizer->shuffle(\@array)
+Shuffles the array reference of the first argument, B<destroys it> and returns
+it. This is using the fisher-yates shuffle.
-use Test::More tests => 3;
+use Test::More tests => 4;
is ($r->rand(), 6_334, "3rd result for seed 1 is 6,334.");
+ my $r = Games::ABC_Path::MicrosoftRand->new(seed => 24);