in reply to Re: Kris Kringle / Secret Santa
in thread Kris Kringle / Secret Santa
However, the group isn't constant. My original data introduces nancy after two years, if we suddenly do this then a latin square doesn't work.my @names = qw/andy betty craig daniel edith/; my %reverse_lookup; @reverse_lookup{ @names } = (0..4); foreach $year (2004 .. 2007) { foreach (sort keys %people) { printf("%04d: %s buys for %s\n", $year, $_, $names[ ($year+$reverse_lookup{$_}) % 4 + 1] ); } }
Also, I must point out that there will be data such as sally can never buy for derek ... not after last years christmas party. So derek is on sally's list .. permanently. Even after we reset it at the end of the cycle.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Kris Kringle / Secret Santa
by tall_man (Parson) on Jan 10, 2004 at 23:32 UTC |