You could speed things by shuffling @words right before the two inner loops.
becomes:foreach my $i (1..$cards) { my %seen; . . . for my $x (1..4) { for my $y (1..4) { my $word; while (1) { my $index = rand(@words); $word = $words[$index]; if (!$seen{$word}) { $seen{$word}++; last; } } . . .
use Algorithm::Numerical::Shuffle qw /shuffle/; . . . foreach my $i (1..$cards) { . . . @words = shuffle @words; for my $x (1..4) { for my $y (1..4) { my $word = shift @words; . . .
In reply to Re: Re: Bingo Challenge
by CharlesClarkson
in thread Bingo Challenge
by Matts
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |