LOTTO A Multi-purpose Random Number Generator by John Fox INTRODUCTION This program is a reasonably flexible random number generator which in its default mode will simulate the LOTTO 6/49 lottery drawings that are common to New York, California, and perhaps some other states. For a LOTTO simulation, simply reply to the first three queries of the program with a carriage return and you are off and running. GENERAL USES Beyond a LOTTO number generator, the program can be used for some informal playing around with random numbers. It asks three questions of the user: 1. How many numbers are to be chosen? 2. What is the greatest value a number can have? 3. Should they be non-zero, unique numbers or should zero and repeats be allowed? The program does not allow more than 12 numbers to be chosen nor does it allow a maximum value of more than 99 for any number. Those are the only restraints. Assuming unique, non-zero drawings (as in LOTTO) one could, for example, simulate the drawing of a 5-card hand from a pack of 52 cards by setting the maximum value for any number at 52 and the number of selections at 5. To generate a random ordering of the numbers from 1 to 10 one would set the maximum value at 10 and the number of selections at 10. Answering the third question to allow zero and repeat numbers, one can generate longer random numbers. By setting the maximum value allowed at 9 each number selected becomes, in effect, the digit of a longer number. Thus, for example, by making the number of selections 5 one would generate 5-digit random numbers. CUSTOMIZING The numeric values chosen at the start of the program can be made the default values by exiting the program and then saving its image by typing SAVE 12 FILE.COM and the A> prompt. The one other item that may need customizing is the clearscreen operation. If your console does not respond to a simple 1Ah (installed in the distribution version of the program) you may patch a string in the program beginning at location 103h. Five bytes are available and whatever is installed must be followed by a 00h. A NOTE ON RANDOM-NESS The program does not perform pseudo random selections (like those done by BASIC). Just how perfectly random this program's selections are I cannot swear, but they derive from the refresh register of the Z80 chip which is in constant and rapid flux, and the underlying randomizing routine (by Robert Zimmerer - Microsystems 10/83) seems pretty good. I have not run any of my own tests on this implementation. If someone does I would be interested in the results. John Fox January 15, 1987 Compuserve #72436,3652