$best = 59528; $max = 1200; for $n (100000..1000000) { srand($n); # Initialize random number generator to zero $target = "Just Another Perl Hacker.\n"; @target = split //, $target; $count = 0; while(@target) { $count++; my $char = $target[0]; if(chr(rand(0x80)) eq $char) { # printf '%x ', $count; shift @target; } } if ($count < $max) { $best = $n; $max = $count; print "max: $max\tbest: $best\n"; } }