in reply to Testing Random Code

It looks like you are making some interesting and perhaps false assumtions. You are assuming that the '9' digit is a valid pin number and that multiple iterations of randomly generated numbers will produce at least one of every digit. A better test would be:
my $pin; 1 while ( $pin = pin() ) =~ /\A\d{4}\z/; my $digits = "\0" x 10; do { substr $digits, $_, 1, $_ for pin() =~ /\d/g; } until $digits =~ /\A\d{10}\z/;
And of course the first test will never end unless a stray gamma ray hits your CPU and changes the constant 4 to some other number.   :-)