## Delving into the Mysteries of Random Numbers

**In the Beginning**

The technology of random number generators has evolved quite a bit since appearing in the Egyptian game of Senet in 3000 BC. Bringing this technology into the digital age has opened up a whole new era in gaming, including digital slot machines as well as the online casino.

**Simulating Randomness**

One of the most challenging tasks in the implementation of an online casino is making sure the simulation of the games is “dead on” accurate to the real thing. That effort requires the combination of many factors, including realistic graphics and sound, accurate rules (and adherence to them!), and a correct simulation of the way the games are played in a traditional casino.

In this article, I will focus on the simulation aspect of online casinos, and specifically, the core of that simulator, the random number generator, or RNG, as those in the industry call it.

We all know that in the long run, under normal circumstances, the house enjoys a natural advantage over the player. But, have you ever stopped to think exactly how that is so? When a magazine, or slot carousel, touts that certain slot machines have a payback percentage of 97% what does that mean? Or, better yet, when you see it advertised that a particular video poker machine pays better than 100%, how can you take advantage of it? And, what should you be prepared for?

The key to the answer to all of these questions lies in understanding the role that the random number generator plays in determining the outcome of the game.

Before we attempt to answer these questions, though, let’s take a look at some of the properties that random number generators have, and why they are important.

**What exactly is Random? **

To be a good random number generator, the random generated must satisfy the following two rules: 1) each number in the range of numbers must have an equally likely chance of being chosen, and, 2) each number picked must be chosen independently of every other number picked.

It is very important to distinguish between the chance of being chosen, and the number actually being chosen. In the first case, we are guaranteeing an equal opportunity to all numbers. In the second case we are enforcing the independence of events, rather than that each number is chosen the same number of times.

The reasoning behind this is that if each number were guaranteed to be chosen exactly the same number of times, it would not be random. For instance, if we had a random number generator that were programmed to generate random numbers from 1 to 3, and the first two numbers chosen were 2 and 1, must the next number chosen be 3? By rule 1) above, each number must have the same chance of being chosen. By rule 2), the previous numbers may not have any bearing on the next choice. This way, we do not know what the next choice will be.

An important consequence of these rules is that it is quite possible, in fact probable in long sequences, that numbers will be repeated. Sometimes, they can be repeated many times in a row.

The most common method for generating random numbers is called the Linear Congruential Method. Another method is called the Additive Congruential Method. These methods generate a sequence of numbers, that when used properly, exhibit the desired random properties.

The key to using these, and many other random number generators, properly, is that the software must continuously generate random numbers, both while the player is playing, and while it is waiting for the player. This eliminates the possibility of the player determining which random number generator is in use, and using the data to guess the next choice. The following story will explain the relevancy.

**Very Lucky Player, or Bad Random Number Generator? **

I have heard this story about a player in Canada, and although I cannot authenticate it, I do believe it to be true.

It seems that there was a Canadian keno player, who played video keno at a particular casino every morning. After many months of losing to a particular machine, he began to notice certain patterns arising in the numbers. After a while, he noticed that once per morning, a certain group of numbers would almost always come up. He began to only bet on those numbers, and as he refined his observations, he was able to pinpoint the approximate time of day that it would happen. And so, at that time, he would bet those spots and win the jackpot. Before too long, the casino noticed the consistent win on the machine, investigated and removed the machine, as well as the player.

Here is the reason it happened:

This particular casino shut off all its machines every night, at closing time (imagine a casino that closes!), and turned the power back on at the same time each morning. In the morning, the random number generator in that machine would start up at its initial value, but this particular machine was not programmed to cycle (continuously generate) its random numbers. Therefore, the sequence of numbers it generated was totally predictable, and the observant player was able to memorize the sequence and take advantage of it. Virtually every jurisdiction in the United States now requires all random number generators to cycle. Additionally, all major suppliers of online casino software cycle their random number generators.

**Testing Randomness**

There is a substantial amount of research devoted to the proof of randomness for specific random number generators. The primary method is to calculate the Chi Squared statistic, or 2. This statistic measures how “close” a sequence of random numbers is to its theoretical distribution.

More practically, for the online gambler, is to visit www.SafeBet.org. SafeBet is a non-profit organization that monitors online casinos for fairness of play. Their testing labs play millions of real games at online casinos to test them for randomness. Those casinos that pass their tests may be listed on their site. SafeBet also runs a dispute resolution program for the casinos that subscribe to their service.

**Putting it Together**

Now that we have a basic understanding of what the random number generator does, let’s see how it’s used in the actual casino game.

As an example, let’s take a typical slot machine that pays back, say, 97% return to the player. This means that on average, over the long term, 97¢ of every dollar wagered is returned to the player.

After putting in your coins, and pulling the handle, the software program inside the slot machine has the random number generator select three numbers. These numbers are then used to determine where each of the three reels will stop, according to a table of stop positions stored in the software program. The reels are then stopped, and if you have a winning combination, you are paid appropriately.

Then, how does the casino ensure that it will hold 3% of the wager, you ask? The answer is that the table of stop positions is calculated such that for each reel, for the total of all combinations of random numbers that can be generated, the payout is exactly 97%. Since each random number has an equally likely chance of being selected, in the very long run, the actual payout of the machine will converge to the theoretical value of 97%. In practice, it can take 1 million or more spins for the payouts to begin to come close to the theoretical values. Until it converges, the actual payout might be higher or lower. For some machines, that number can be as high as 20 million spins. This, of course, means that there will be periods when the casino wins more than expected, and times when it wins less, which is why people do get lucky from time to time.

**Machines that pay more than 100%**

Occasionally, players come across machines that advertise that they pay out more than 100%. Invariably, these offers are for machines that require some sort of skill. The most common example is video poker. In fact, there are several online casinos that have video poker machines that pay over 100%. The operators of these casinos are betting that players on these machines cannot play well enough to take advantage of the generous paytables they offer.

In fact, if you can learn to play these games perfectly, you can eek out a small profit, but you do have to put in your time. Two of the casinos that offer 100%+ are www.inetbet.com and www.eworldcasino.com. The Joker Poker machines at these casinos are set to pay slightly higher than 100%.

**The Catch**

Before you run off to make your fortune playing video poker, there are a couple of things you should consider.

First of all, make sure you learn to play the game perfectly. Each mistake you make costs you some of your advantage over the house. Get a video poker trainer such as VPTutor by Panamint software to get you in shape.

Second, remember the rules about random number generators. Past events have no bearing on future results. In other words, just because you haven’t hit a royal flush in a long time, doesn’t mean you will hit one soon. Make sure you have a large enough bankroll to survive the dry spells. As a rule of thumb, you should have a bankroll of $2,000 for a 5-coin 25¢ video poker machine, and $8,000 for a 5-coin $1 machine.

**Random Thoughts**

Digital random number generation is an intricate and complex process requiring advanced knowledge in both mathematics and statistics. Without it modern casino games could not exist as we know them. Good random number generators have allowed developers to create realistic and legitimate online casinos, and enable them to develop the fantastic new games of the future.