Newsletter Signup
Stay informed with the
NEW Casino City Times newsletter!
Recent Articles
Best of Donald Catlin

Gaming Guru

author's picture
 

Non-Random Randomness - Part 1

1 June 2002

By Donald Catlin

    With a title like the above oxymoron you may be thinking that "Catlin has finally lost his marbles."  Well, many of my friends and colleagues would probably agree that there is ample evidence to support such a conclusion; however, the present articles are not part of it.  Let me explain.

    If we turn the clock back 60-100 years when slot machines were strictly mechanical devices, it was tacitly understood that the stopping of the reels had to be random.  This meant that, at the very least, every symbol on each reel should be equally likely, each spin should be independent from the last stopping position, and no sequence of prior stopping positions should enable a prediction of the next stopping position.  I used the word 'tacit' because I doubt if slot manufacturers ever really wrote down these criteria nor worried about them being violated.  Then in 1948-1950 an event occurred that brought these issues to the attention of slot manufacturers in a dramatic manner.

    In 1946 an Idaho potato farmer was visiting a friend of his in Las Vegas who was a slot mechanic and was repairing broken slot machines.  This Idaho farmer, while helping out his friend with the repairs, noticed that some machines of that vintage had a non-random feature.  These machines contained a device called the clock fan, which determined how far each reel would turn on the next spin based upon when the pull lever was released during a 7 or 8 second period following the previous play.  By noting the current stopping position of the reels a skilled player could reduce the range of sequential stopping positions of the reels on the next play by the way in which the pull lever was released.  According to Scarne [5] the man put his idea to the test and relieved Las Vegas of about $30,000 in slot winnings in a two-week period.  I can't vouch for the amount but subsequent events proved that he was on to something.

    I am not sure exactly what scenario took place between 1946 and 1949, but by 1949 to 1950 there were hundreds of players using this Idaho farmer's technique and they were called Rhythm Players.  In 1950 there was even a pamphlet published explaining how to "rhythm" a machine.  These players took the Nevada casinos for millions of dollars but by 1951 the fun was over.  The slot manufacturers had developed and installed on each machine a device they called a variator which insured that each play was completely random and independent from the previous play.  Thus, in the world of slots the words "random" and "independent" were no longer esoteric notions; they were bread and butter issues.

    Now let's jump ahead 35 years.  Although the old mechanical machines had added electricity as early as the 1930s, the addition was primarily for the purpose of adding lights, music, bells, and other features to attract players.  By the 1960s, however, electrical circuitry was becoming more and more of an integral part of the operation of slot machines; these were all referred to under the generic name electro-mechanical machines.  Quite frankly, I am not sure just how the issue of randomness was handled during this era but my guess is that it was handled with the same mechanical devices except they were driven by electric motors rather than player muscle.  The issue is moot, however, because in the mid-80s slot machines underwent a major revolution; one that motivates the title of these articles.

    As I see it there were three things that came together in the 70s and 80s that gave birth to modern day slots.  The first was the creation of the microprocessor and its availability to the general public in the 1970s.  The second occurred on May 15, 1984.  It was on this date that a patent filed on February 24, 1982 by Inge S. Telnaes of Reno, Nevada was approved.  The Telnaes patent, now owned by International Gaming Technology by the way, had several pages of diagrams and discussions that in retrospect were really unimportant, but had one idea that was to change slot machines forever.  That was the idea of a virtual reel.  The idea was that the reel symbols could be stored in a memory device in the machine, called a virtual reel, and could be randomly accessed by a program in a microprocessor, called a random number generator or RNG, and this would assure complete independence from one play to the next (or so it seemed).  What is more, the Telnaes patent postulated virtual reels that contained more stops than were contained on the real reels, which meant that the probability of a particular symbol appearing on the pay line had nothing to do with its frequency on the real reels and everything to do with its frequency on the virtual reels.  If this seems deceptive to you, consider the following quote taken from the Telnaes patent submission: "Thus, it is important to make a machine that is perceived to present greater chances of payoff than it actually has within the legal limitations that games of chance must operate."  Any doubt?

    Of course the symbols chosen from the virtual reels would have to be displayed on the real reels and this is where the third piece of this picture emerges.   JPM Company in Wales, U.K. were already manufacturing slot machines driven by stepper motors that were used on so called nudge machines popular in British pubs.  These motors were so named because they could move the reels forward or backward one symbol after they had stopped.  American companies first became aware of these motors in 1985 when they were used by Universal Co. of Japan in one of their slot machines.  In brief, these stepper motors could be used to spin slot reels for a given period and then stop on any predetermined symbol.

    So here is the scenario.  When you walk by a slot machine it looks as if nothing is going on.  Inside the machine, however, a microprocessor is spitting out thousands of random numbers each second.  When you drop your coin (or pull the handle, or hit the spin button, it varies) you get whatever number (or maybe three numbers) is coming out of the RNG at that instant.  The microprocessor then looks up whatever stopping position corresponds to your number (or numbers), spins the wheels, and then stops the real reels at that position. [Note: The exact scenario varies with the manufacturer but they are all similar to what I describe.  For a discussion of the differences see the excellent pair of articles by my editor, John Robison [3][4].

    So how does one create an RNG?  Years ago when I was a graduate student at the University of Florida I had an amusing discussion with my Linear Algebra professor about children.  His take was this: "The trouble with children is that we tend to anthropomorphize them."  In case you're not familiar with that dollar-and-a-half word it means to ascribe human characteristics to something.  With all of the modern glitzy software plus words such as robotics, artificial intelligence, cybernetics, and the like, I think many people tend to treat computers like my professor felt they then treated children.  Sometimes when I am asked to make a quote on a gaming analysis job, the gaming developer looks at the price and says to me "Can't you just put it on the computer?"  The unspoken assumption here is that I can just walk up to my computer and say "Hey, Mr. Computer, can you just work this out for me?"  Well the fact is, of course, that it doesn't work that way.  Computers can do simple arithmetic, they can do logical comparisons, and a few other simple tasks, all incredibly fast, but they have to be told what to do at every step.  So if we want an RNG we have to tell the computer every detail about how it is to work; we have to build it.

    Now computers are deterministic devices; there is nothing random about them.  Everything proceeds from step to step in a logical and orderly fashion (I know, when you're on the internet it doesn't always seem this way).  If you tell a computer to give you a random number, it has no idea what to do unless someone else has already written an RNG for the computer to access, and that RNG developer faced the same deterministic machine that faces us if we wish to build an RNG.

    I don't know who first decided how RNGs were to be structured but one of the earliest and most definitive workers on this problem was Donald Knuth whose groundbreaking work appeared in 1969 [2].  Knuth's idea, and perhaps that of others as well, was that an RNG should be a recursive function.  Now don't stop reading; the idea is simple.  Here is an example of a recursive function:

                            (1)    a0 = 1

                            (2)    an+1 = an + 2  ; n = 0, 1, 2, 3, ...

The formulas (1) and (2) produce an infinite sequence of numbers a0 , a1 , a2 , a3 , ... as follows.  Obviously a0 = 1.  Letting n = 0 in (2) we obtain the relation a1 = a0 + 2 and since a0 =1 we have a1 = 1 + 2 = 3.  Next, letting n = 1 in relation (2) we have a1+1 = a1 + 2 or equivalently a2 = a1 + 2.  Since a1= 3 it follows that a2 = 3 + 2 = 5.  I think you get the idea.  It is a "bootstrap operation;" each term is computed from the previous term using (2).  The resulting sequence is 1, 3, 5, 7, 9 , ... .  "Wait just a darn minute," you're probably thinking, "that sequence doesn't look very random to me."  No, it doesn't look very random to me either.  In fact I think anyone looking at the result could easily determine (1) and (2) in a few seconds.  So what's the story?

    Let me write down the general structure of our RNG.  It is an infinite sequence of numbers a0 , a1 , a2 , a3 , ...  generated by a pair of equations that are of the general form

                        (R1)    a0 = seed

                        (R2)    an+1 = f (an)

where 'seed' is the name of the first number in the sequence and f is a function (algorithm, formula, procedure, instruction) for calculating an+1 from an . The idea is that seed should be chosen in a completely random manor and the function f should be complicated enough that the resulting sequence not only looks and acts like a random sequence but that anyone looking at any (or all) terms in the sequence would not be able to predict the next term, that is, would not have a clue as to the nature of f.  Sounds like a tall order doesn't it?  It is, but as we have seen from our earlier discussions, this is essential; casinos don't want a modern day repeat of the rhythm player.  By the way, numbers generated by (R1) and (R2) are referred to as pseudo random numbers, a tacit admission that they are not random at all.  In next month's article I'll discuss the function f in (R2) above and investigate the phrase "looks and acts like a random sequence" that I used above.  For now I want to focus on (R1).  I think the following true story should make my  point.

    The Casino de Montreal opened in Montreal, Canada in October of 1993.  It is a beautiful structure built on an island in the St. Lawrence river; the island is made out of the soil removed when the vast Montreal subway system was built.  It is unique in that it is the only casino I have ever been in that has windows so that you can tell night from day.  Among the many games that the Casino de Montreal offers is the game of electronic KENO, and that is what this story is about.

    On Sunday, April 10, 1994, a freelance computer consultant by the name of Daniel Corriveau, playing electronic KENO at the Casino de Montreal, became the first known North American to beat a casino's electronic KENO game by successfully picking 19 out of 20 winning numbers.  What is more, he did this three times in a row.  The electronic KENO game was promptly shut down.  The provincially run casino dragged its feet in revealing why they had suddenly closed the game and appeared unwilling to acknowledge the extent of Corriveau's win.  The media had a field day as a police investigation into Corriveau's statistically suspect wins caused a plethora of headaches for the government agency responsible for the controversial new casino.  The game reopened (though not for Daniel Corriveau) despite the unusual win, in part because it took ten days for a memorandum about it to travel from one desk to another through the government labyrinth (reporting procedures have since been modified).  Finally, after a thorough police investigation, including a polygraph test, Mr. Corriveau was issued a cheque for $620,000 a full 17 days after his win.  His winnings were shared by the three people who went with him to challenge the Casino de Montreal that Sunday night in April.  For a more complete account of this amazing story see [1].

    Here is some background for an explanation of what happened.  Most, if not all, computer languages contain an RNG that is constructed like (R1) and (R2) above.  For the convenience of the computer programmer these RNGs always begin the random sequence with the same seed.  This is so the programmer can debug his various subroutines and logical structures using the same set of numbers over and over again, differences and errors thereby being due to the program itself and not due to the random behavior of the RNG.  Once the programmer is convinced that the program is sound he puts an instruction near the beginning of his program that reads RANDOMIZE, or RANDOMIZE TIMER, or SET SEED, or some other such instruction.  This does the following.  The computer looks at the real time clock inside the computer as this instruction is executed and based upon whatever time it is at that instant, the computer uses this information to compute a seed.  No one, not even the programmer, has a clue as to what that seed is.  This is as close to random as an RNG gets.  Once the seed is set, the rest of the pseudo random sequence is as deterministic as our example in (1) and (2) above.

    Apparently, at some point during the night or day, a certain bank of KENO machines at the Casino de Montreal were shut off for a time, possibly to clean the area, I'm not sure just why.  Whatever the reason, Corriveau noticed that when the machines resumed play they reseeded to the exact same seed.  This meant that the exact sequence of KENO numbers were being chosen day after day.  Corriveau simply recorded the sequence and made three bets at the appropriate time.  The rest is as I described above.  Notice that Corriveau did not need to know the seed nor did he need to know the algorithm f.  All he needed to know was how an RNG worked and then to note that the same sequence was appearing day after day.  The casino's explanation of why this had happened was to say that the devices had not been equipped with a real time clock.  To me this is not very credible; it is hard to imagine such a major manufacturing error.  I think that whoever wrote the code for the RNG simply forgot to put in a RANDOMIZE or similar command at the beginning of the program.  We'll probably never know the truth but, if I am right, it certainly was a costly programming error.

    So, it is essential to randomly seed the RNG, that is, to choose the number 'seed' on the right hand side of (R1) in a completely random fashion.  To do otherwise, as we have just seen, can be costly.  See you  next month with Part 2

References:

[1]    Casino Player Magazine, September 1994

[2]    Knuth, Donald, The Art of Computer Programming, Vol. II,
        In: Seminumerical Algorithms, Addison Wesley, Reading, MA 1969

[3]    Robison, John, A Brief History of the Slot Machine, Part I, The New
        Chance and Circumstance, Issue #24, Spring 2000

[4]    Robison, John, A Brief History of the Slot Machine, Part II, The New
        Chance and Circumstance, Issue #25, Summer 2000

[5]    Scarne, John, Scarne's New Complete Guide to Gambling, Simon
        and Schuster, 1974, pp 451-456

Donald Catlin
Don Catlin is a retired professor of mathematics and statistics from the University of Massachusetts. His original research area was in Stochastic Estimation applied to submarine navigation problems but has spent the last several years doing gaming analysis for gaming developers and writing about gaming. He is the author of The Lottery Book, The Truth Behind the Numbers published by Bonus books.

Books by Donald Catlin:

Lottery Book: The Truth Behind the Numbers