in reply to How to generate lotto numbers, i.e. How many tickets do you want? 3 and it prints 3..and so on...
for ($i=0; $i<$NumbersOfTickets; $i++) { $lotto[$i]= int(rand($HighestNumberOnTicket)) + 1; }
Thinking on that, how do you suppose you might generate a series of lottery tickets?
There are also a number of stylistic changes you may consider that would make your code more resilient to bugs. I'd be happy to expound upon them if you like, but what you've written is certainly adequate. Consider reading Use strict warnings and diagnostics or die and Foreach Loops in perlsyn. I also note you seem to be rolling your own CGI code: see lesson 2 in Ovid's CGI Course - Resurrected and Updated!
|
|---|