On 26 Feb 2004 16:54:12 -0500 Cy Kurtz <[EMAIL PROTECTED]> wrote: > Hi all. I have a little program here that generates a lottery play slip > for the mega-millions game. It selects 50 of the 52 numbers exactly once > over 10 tickets of 5 numbers each. It then selects 10 super ball > numbers, one for each ticket. It then prints it all out(duh).
The snippet below has been modified from an Abigail post and should provide 50/52 unique numbers. #!/usr/bin/perl while (keys %hash < 52) {$hash {int((+rand)*52)+1} = 1} @array = keys %hash; #now just get 50 of them foreach $n(1..50){ print "$array[$n]\n"; } -- Owen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>