Lotto Luck: A Computer Demonstration for the Classroom

Ronald L. Wasserstein
Washburn University of Topeka

Journal of Statistics Education v.2, n.2 (1994)

Copyright (c) 1994 by Ronald L. Wasserstein, all rights reserved. This text may be freely shared among individuals, but it may not be republished in any medium without express written consent from the author and advance notification of the editor.

Restrictions. Lotto Luck is freeware designed for use by those who teach probability and statistics. Its purpose is to serve as an aid for teaching important basic concepts. While this program can be played as a game, it is not intended to be one. It may be copied and used freely. When used or shared, authorship credit should be given. The author is also interested in your comments and suggestions for improvement.

Requirements. An IBM-compatible computer running DOS 5 or higher with at least 640K memory and a CGA or compatible monitor is required. Contact the author if the program will not run with your monitor.

Download Lotto Luck to a Local File

Key Words: Probability; Lottery; Gambler's ruin.


Students of all ages seem fascinated by the lottery, making it a ready tool for illustrating basic probabilistic concepts. The author has developed a program called "Lotto Luck" for IBM PC compatibles which has been used in over 100 classrooms from grades 6 through 12 and with dozens of college classes and civic groups to demonstrate what happens to the "earnings" of the frequent lottery player over a period of time. We discuss how to use the program and provide information for obtaining the compiled code by ftp.

1. Introduction and First Efforts

1 From the day the lottery opened in Kansas in 1987, my statistics students began reporting their successes in the game. Most were certain that they were winning more than they had spent (which, for the purposes of this discussion, is how we will define "success"). In an effort to show students the likelihood of such success, we developed computer simulations and graphs to show the probability of being "in the black" after a specified number of attempts in various lottery games (Wasserstein and Boyer 1990). Students who understood the graphs were surprised and intrigued by the results, but we found that many students still did not understand that playing more often did not lead to a higher probability of success. Another approach was in order.

2 When the lottery opened here, all the games were instant games. Thus, our first effort involved the development of a computer "scratch it" game that allowed the participant to choose from one of several options relating to prize structure, but all having one key element in common: an expected return of $0.45 for a $1.00 ticket, the average return in Kansas Lottery instant games. The participant might elect to purchase, for example, 1000 tickets in a game that paid out prizes of $0, $2, $5, $50, $500 and $5000. A table was displayed on the screen that showed how many of each prize was earned during the 30 seconds or so the computer took to simulate the 1000 purchases. At the end, the participant's earnings were compared to his/her $1000 investment. Students were uniformly surprised at how much less than $1000 they had won. This program was successfully used in many classrooms, and is available from the author upon request.

3 Before long, however, the on-line games opened, and everyone was much more interested in them, no doubt because the grand prizes were many times larger. These games currently include: (1) "Cash Lotto," a statewide 6/33 lotto (i.e., the player chooses six distinct integers from the integers 1 to 33), with fixed prizes for matching four and five and a parimutuel grand prize for matching six; (2) "Powerball," a multi-state 6/54 lotto game similar in structure to Cash Lotto; and (3) "Club Keno," which is nearly identical to the game of Keno played in Las Vegas and elsewhere. The establishment of on-line games resulted in the development of the "Lotto Luck" game.

2. Lotto Luck

4 Lotto Luck is a small scale on-line lottery simulation for 1 to 500 players. Briefly, the game works as follows (details are in the Appendix). Each player selects or is assigned six of the first k integers, where k may be specified from 7-60, as his/her lucky numbers. Each turn proceeds as follows:

  1. One dollar is taken from each player.
  2. Forty-five cents of each dollar is placed in the prize pool.
  3. The prize pool is divided into three smaller pools (in any specified proportions) for matching four, five or six numbers.
  4. The house draws its six numbers. These are compared against all players' numbers.
  5. All players who match exactly four split the match-four pool. Ditto for matching five and six.
  6. Unclaimed prizes are carried over into the next pool.

5 As the game proceeds, each player's expenses and winnings are tabulated, and can be viewed at any time.

6 Most of the salient features of lotto games in Kansas and other states are captured in this simulation. The most important feature NOT simulated is that the grand prize in most lotto games grows faster than in this game because the prize is paid out over 20 years.

3. How to Use Lotto Luck

7 The process begins when a teacher invites me to speak to a class about the lottery. I ask the teacher to provide a list of students in the class, along with six lucky numbers chosen by each student. Typically, for classes of 15 to 30 students, the six numbers are selected from the integers 1-21. This results in a probability of matching six on any given turn of 1 in 38,760, which means that usually someone will match six at some point during the one hour or so required for the presentation. The students' names and selections are entered in advance of going to the school.

8 Required equipment for this presentation is an IBM PC or compatible computer (see Appendix 1), an overhead projection panel (or a very large monitor), and an overhead projector. The latter is usually available at the school; I carry the computer and the projection panel with me.

9 To begin the presentation, I ask how many have played the lottery, and then jokingly remind them that since they are under 18, they should not have played! I then discuss a little about the history of the lottery in our state and explain the difference between instant and on-line games.

10 Next, we discuss in very basic terms what is meant by parimutuel wagering. In particular, I explain that the prizes come from the money spent by the players, and that unclaimed prizes carry over until the next drawing.

11 At this point, I discuss the Powerball game, the most popular on-line game in our state, and point out that the probability of winning the grand prize is about 1 in 55 million. To illustrate the magnitude of this probability, I use the following illustration: "Imagine that the Washburn University campus (a little less than 160 acres) is covered with dollar bills laid end to end and side to side. One of these bills is marked on the underside. You are dropped blindfolded into a randomly selected spot on the campus, and asked to pick up a dollar bill. Your chance of selecting the marked bill is about the same as your chance of winning Powerball."

12 We proceed to discuss the game they will play. I tell them that their names and lucky numbers are stored in the computer. I review how the game works, essentially explaining what is in Section 2 of this paper. I discuss the probability of matching four, five or six numbers, and with older groups show how these probabilities are computed.

13 As we begin the game, someone will usually ask, "Is this for real money?" I always answer, "If you want it to be for real money, it will be. But you must wait until the end of the game to vote, and if a majority want it to be real money, then it will be." I ask the students to think about how I can make such a bold promise. I assure them that, while it is possible to cheat, I will not, nor will I ever need to.

14 We play one turn at a time, at first, giving students the chance to see their names displayed as they win. Every so often, students are allowed to view their score, so they can see how much they are winning. After a while, the turns are played much faster. The students' interest in winning the grand prize increases as that prize pool accumulates. The students marvel at how much they are winning.

15 Eventually, some bright student points out that they are spending one dollar for every play. At that point, I show the scores in terms of profit (amount won less amount spent) instead of winnings. To their astonishment, most if not all students have a negative profit. We continue to play as their eagerness to match six and win the grand prize grows, but as we do so we discuss the fact that playing more seems to result in losing more, not getting ahead. We also discuss why various number choosing "strategies" are basically nonsense.

16 Finally, someone wins the grand prize, which has usually become substantial by this point. Scores are displayed, and almost always only the grand prize winner is ahead. I now ask the students for their vote on whether the money should be real, and, of course, there are many against and one in favor. Then I ask them to tell me why it comes out this way. Someone will say the odds are against them, which we discuss, but someone else usually points out that the house cannot lose because the house is not using its money, but the players' money, for prizes. We discuss the concept of expected value and relate it to casino games.

17 We conclude with a brief discussion of the gambler's ruin. I have often used this example: "Suppose you were rich, like Donald Trump. Or suppose you were really rich, like Ivana Trump after the settlement. No matter how rich you might be, if you play the lottery long enough, you will eventually run out of money." Students leave with a much clearer understanding of their prospects.

18 I point out to students that I am not "anti-lottery." Many people find a great deal of enjoyment in playing. It is important, however, for players to have a realistic view of their chances of success. In particular, playing more often does not increase the likelihood of success, as I have defined it.

4. Final Remarks

19 Working with thousands of youngsters (and not-so-youngsters) using this program in the past few years has been thoroughly delightful. Students become really engrossed in the game and surprise their teachers with their enthusiastic questions. Cheering, clapping and groaning frequently take place. The best moment is the moment when they discover that the amount they have won pales in comparison to the amount they have spent. A whole new perspective is instantly gained.

20 I hope that many of you will be able to use this program to share with others. In the next few months, I will be rewriting the program in C or Visual Basic or both to make it more portable, so suggestions for improvement are welcome.

21 The author wishes to thank the editor of JSE and the reviewers for their helpful suggestions which led to the improvement of the manuscript and the accompanying software.

Instructions for Use of the Lotto Luck Program


Lotto Luck is freeware designed for use by those who teach probability and statistics. Its purpose is to serve as an aid for teaching important basic concepts. While this program can be played as a game, it is not intended to be one. It may be copied and used freely. When used or shared, authorship credit should be given. The author is also interested in your comments and suggestions for improvement.


An IBM-compatible computer running DOS 5 or higher with at least 640K memory and a CGA or compatible monitor is required. Contact the author if the program will not run with your monitor.


Lotto Luck simulates participating in a small lottery. The players select six unique numbers between 1 and n (n > 6 specified by you). Players win by matching four, five, or six of their numbers with those selected by drawing. Players are paid for their winning numbers based on the following parimutuel formula: Each play of the game costs the player $1. From each dollar, 45 cents is placed into the prize pool. The prize pool is divided into three smaller pools, which are distributed to the winner (or divided among multiple winners) at the end of each play. When no one wins, prizes carry over to the next play. You may specify how much of the prize pool goes into the match-four, match-five or match-six pools. The default is a 50%/30%/20% split. The author has found this split to be very useful in maintaining interest in the game.


The program is in a file named lotto2b.exe. Start the program by typing lotto2b at the DOS prompt.

At the start, the title screen will appear. Press any key to remove it.


You will be prompted to enter the player file name. The player file contains the names and the lottery numbers selected by the players.

Next, you will be given a choice of playing Lotto Luck or entering player names. If you have already built your player file, enter 1 (and skip down to SIMULATION in these instructions). Otherwise, to setup or edit a file, enter 2.

You will then be given the following choices: If you wish to clear the file (that is, erase all names and numbers), enter 1. If you would like to erase player totals only (that is, to clear the results of a previous simulation for these players), enter 2. Otherwise, you need only to press the ENTER key to proceed to player entry.

Finally, you will be asked to enter the "highest choice." This is the value n described above. For practical purposes, the value of n must be determined by the number of players. If n is too large, players win too infrequently. Values of n between 20 and 23 are practical for most classes.

Player entry:

Instructions on the Player Entry screen are fairly self-explanatory. You may have up to 500 participants in the simulation.

Note the following items, which are indicated on the screen:

At the end of player entry, you will be given the opportunity to write the contents of the player file to a text file, which can then be printed by other software.


As you enter this portion, facts about your player file will be displayed on the screen. You will be prompted to input the prize pool weights. To accept the default of 50/30/20, just press ENTER. Otherwise, type n. You will then be allowed to enter your own weights, which must be between 0 and 100 and total 100.

Now, the simulation begins. Each play of Lotto Luck proceeds as follows. A set of numbers is generated by the computer. The set is compared against the selections of all players, and winners are displayed on the screen. Match-four winners are displayed first. Press ENTER to get Match-five and Match-six winners, if any. Each player's winnings are stored in the player file.

When the prompt "Another?" appears on the screen, pressing ENTER (denoted <RET>) causes another play to take place.

A number of options are available at this prompt, and they are displayed in brief at the bottom of the screen. The choices are "<RET>,a,s,p,m,t,g,q". A description of these follows:


Wasserstein, R. L., and Boyer, J. E. (1990), "Probability and Instant Lottery Games," STATS, No. 3, 7-10.

Ronald L. Wasserstein
Department of Mathematics and Statistics
Washburn University
Topeka, KS 66621

Return to Table of Contents | Return to the JSE Home Page