Avoid numbers that others commonly use.
This commit is contained in:
parent
ec22febde3
commit
0237e90fd6
1 changed files with 19 additions and 3 deletions
|
@ -26,13 +26,23 @@ while ($curTix < $tixCount) {
|
|||
my $rr;
|
||||
while (read($randomFH, $rr, 4) != 4) { }
|
||||
$rr = unpack("I", $rr) % scalar(@choices);
|
||||
$rr = $choices[$rr];
|
||||
if (scalar(keys(%done)) < @choices) {
|
||||
next if defined $done{$rr};
|
||||
$done{$rr} = 1;
|
||||
} else {
|
||||
next if $rr < 31;
|
||||
my %inThisTicket = map { $_, 1 } @{$tix[$curTix]}; next if $inThisTicket{$rr};
|
||||
my $min = min(grep { $_ > 31} values %done); next if $done{$rr} > $min;
|
||||
|
||||
my $hundred;
|
||||
while (read($randomFH, $hundred, 4) != 4) { }
|
||||
$hundred = unpack("I", $hundred) % 100;
|
||||
|
||||
next if ($rr <= 31) and ($hundred > 40);
|
||||
next if ($rr == 7) and ($hundred > 5);
|
||||
|
||||
my $min = min(@done{grep { $_ > 31} keys %done});
|
||||
next if $done{$rr} > $min;
|
||||
$done{$rr}++;
|
||||
}
|
||||
push(@{$tix[$curTix]}, $rr);
|
||||
}
|
||||
|
@ -40,5 +50,11 @@ while ($curTix < $tixCount) {
|
|||
}
|
||||
my $count = 1;
|
||||
foreach my $ticket (@tix) {
|
||||
print "Ticket $count: ", join(" ", sort { $a <=> $b } @$ticket), "\n";
|
||||
print sprintf("Ticket %2d: ", $count), map { sprintf("%2d ", $_) } sort { $a <=> $b } @$ticket;
|
||||
print "\n";
|
||||
$count++;
|
||||
}
|
||||
#print "\n\nStats\n";
|
||||
#foreach my $choice (sort { $a <=> $b } keys %done) {
|
||||
# print sprintf("%2d used: %2d\n", $choice, $done{$choice});
|
||||
# }
|
||||
|
|
Loading…
Add table
Reference in a new issue