Lottery Numbers

Last year when I was living in Arizona, somebody figured out that the computer program that selected the numbers for the daily pick three game had a glitch that prevented the number 9 from being generated.

So, for about the first three months this particular computer program was used, anyone who picked 9 somewhere in the three number game had a 0% chance of winning.

This is not an UL; I was actually living there when this came to light. Huge news in the papers and TV. They tried to make amends by lowering the price of a ticket or something (I don’t remember specifically, as I don’t play the lottery), but basically it was “too bad, you loose!”

I hope that is how to do the link.

Are the pick-3 numbers in Arizona picked by computer or do they use the ping-pong ball machines.

“You can’t run away forever; but there’s nothing wrong with getting a good head start.” — Jim Steinman

Dennis Matheson —
Hike, Dive, Ski, Climb —

They may use ping-pong ball machines now, after the number 9 SNAFU; but at the time, the numbers were picked by computer.

Just goes to show you how many steps we can take backward by our technology advances. I’m sure ping-pong balls work just fine, but someone probably said “hey, we should get with the times and use a computer!”

There have been screwups in lotteries before. A famous example is the 1970 Vietnam draft lottery. The balls used were not mixed properly before they were put in the drawing barrel, and as a result you had a much better chance of being drafted if your birthdate was earlier in the year.

There was also a Keno computer in Montreal that had a serious flaw - it restarted with the same random seed every time the power was shut off and restored. This wasn’t a problem in Nevada, since the casinos are open 24 hours a day. In Montreal, the casinos close for the night, so the power was turned off. A computing science student discovered the flaw and made a bundle.

Not a flaw, but here’s the funniest lottery story I’ve heard:

I think it happened in Ohio some years ago. This guy was drunk and went to buy a lottery ticket. Accidentally, he bought 2 tickets with identical numbers, which, in general, is stupid. However, it turns out those were the winning numbers. Somebody else won, as well, and instead of winning only half, the drunk man wound up with 2/3 of the jackpot.

I read in the NY Times (I think) about how some computer security proffesionals discovered that some online gambling sites were using the time to seed their pseudo-random number generators(PRNG), so they were able to predict which cards would come up.

Yes, this was the case for and, which used the same software.

The problem is that a computer can’t really generate random numbers. It generates pseudo-random numbers by taking a ‘seed number’ and running certain algorithms to create a number from a large space of possible numbers. If you use the same seed, you get the same sequence of numbers out.

Choosing a seed number is difficult. The standard RANDOMIZE routine in most compilers uses the current second of the day, month, or year. Other people have used time delays between key presses and such.

Now, a deck of cards can be ordered in billions of different ways, essentially making the composition of the deck random if it is shuffled properly. However, the routine that planet poker used seeds the PRNG with the time of day to the second. There are only 86,400 seconds in a day, so the actual order of the deck was one of 86,400 possibilities.

Using that knowledge, it’s easy to watch the cards as they come out (in Texas Holdem there are five ‘community cards’ that are face-up on the table). Once you’ve see that many cards, you can do a fast pattern match against the 86,400 possibilities and find the exact order of the deck. Once you have that, you know which cards every player is holding, and you can take them to the cleaners. There were apparently some people who had done exactly that and were cleaning up in these games.

This is one good reason to be wary of online gambling. You have no way of knowing if an online blackjack game or roulette game is ‘honest’, and the operators of the game may not even know. On the other hand, there are opportunities to exploit these casinos through the same method. If you found an online blackjack game that used the same type of PRNG, you could predict the exact order of the cards coming up after playing a hand or two and adjust your bets accordingly.

Some computers that require very good random number generators go to extraordinary lengths to ensure that their numbers are non-predictable. One method, for instance, is to build a circuit which measures real-time noise on the AC line powering the computer and builds a seed out of multiple measurements, giving them the billions of possibilities they need without being able to predict what they might be.

Sorry, I screwed up the comments about the random number generator. The one used on actually used a seed which allowed four billion possible shuffles. But a real deck of cards can be shuffled 52! ways, or about 8 X 10^67 different combinations. So all the other comments still stand. Their ‘shuffle’ only produced a very tiny subset of all possible shuffles - few enough to allow a computer to find the correct configuration of the deck in real time.

OK, I’m in the right thread.

What about waiting until the jackpot is huge, let’s say $200 million. Spend $5 million or so and buy up 50% of combinations. Even if the winnings get split four ways, that’s a 50% chance of winning $50 million an a $5 million investment. Details are left as an excercise for the student. (I read about somebody doing this.)

dhanson, that was a great post. Very intersting.

proman: In regards to buying up the numbers… I remember reading about an Australian consortium trying something like that, and they whiffed, losing ~$100 million. Why stop at 50%? If you think the odds are in your favor, why not buy every combination?

Great idea, but for your standard Lotto-type game (for instance, choosing 6 of 45 balls), there are about 5.8 billion combinations. Which means that for a normal jackpot (say 5.8 million dollars), you stand to make 0.1 cent for every dollar you spend. Sounds like a good investment to me.


Forget that stuff about the standard lottery having billions of combinations - it’s not correct.

If a lottery doesn’t allow the same number to be used twice, the number of combinations available in a 6/51 lottery is 18 million. For a 6/54, it’s 26 million.

Theoretically, if the dollar value of the jackpot is higher than the odds of hitting it, you have a positive expectation, meaning you make money with every ticket you buy. There is an Australian syndicate that has thousands of members and acts almost like an investment fund - they collect funds to buy lottery tickets when a lottery jackpot hits a certain amount.

There are complications: First, someone may tie you, or possibly even two or three people. Second, there may be secondary jackpots that come out of the prize fund. For that reason, the lottery syndicates won’t be interested unless the jackpot is much, much higher than it has to be. Perhaps two or three times as much.

Finally, it’s really hard to buy that many tickets. When the Australians beat a lottery in the U.S. a few years ago, they had a complicated infrastructure of money men, runners to hit all the lottery machines they could find, etc. Even so, they ran into a bunch of problems and wound up only buying about 75% of the tickets. They still hit the winning jackpot and won the whole thing.

Incidentally, as an individual buying lottery tickets, it’s pretty much irrelevant how big the jackpot is, due to something called utility theory. Basically, the utility value of the lottery doesn’t really change if the jackpot doubles, because the time and money it takes you to play vastly overshadows the value of the money multiplied by the chance of winning.

Utility theory is very interesting when applied to gambling. Most of the work on utility theory has been done in the insurance industry (insurance is a ‘bad bet’ in that insurance payments have a negative expectation - you expect to lose that money, yet people almost universally believe it’s smart to buy insurance. Utility theory explains why). In gambling, utility theory tells us things like why poor people buy more lottery tickets than rich people, why people buy them at all, etc.