Stay informed with the
Recent Articles
Best of John Robison

# An in-depth look at the RNG

18 January 2010

John,

I have looked through most of your archives and cannot find a detailed explanation of how the RNG and lookup tables work in a slot machine. I have a good understanding of the process but a few things about the process I can't put together. Can you fill in the gaps for me?

You press the stop button and the RNG takes a number the "seed", which I understand to be typically based on the milliseconds that have elapsed since 1/1/1970 and divides that number by the number of positions in the virtual reel table, usually 64 or 128. The remainder of that number is used to find the actual stop or reel position on the machine. This system makes complete sense to me (and possibly my system is slightly off). My more important question is if a time "seed" is used and only one pseudo-random number is used, how does each reel get assigned a truly random number? My thought process would leave me to believe that all the reels would get the same number picked for them with this process. Even if there was a determined delay in the process of picking random numbers the resulting combinations for reels 2 and 3 would be a result of reel one. Wouldn't that be great to hit the top prize on the more difficult machines every 128 spins? Can you please explain this process in depth explaining the seed and the RNG's process to determine a number for each reel?

Thanks,
Kris

Dear Kris,

Here's the way the RNG works in a slot machine.

The RNG in a slot machine is nothing more than a function that takes one or more parameters and performs some mathematical operations on them to generate a number. The parameters are usually past results from the RNG. To keep things simple, let's look at an RNG that takes just one parameter.

The RNG is constantly running (that is, it is generating numbers even the machine is not being played), taking the last value calculated and generating a number from it. Even though the RNG is constantly running, there has to be a time when it starts running. There is no prior result to pass into the function at this time, so we have to choose a value to pass in, which is called the seed value. Like you said, this seed value can be based on the current time.

After we've calculated a seed value and generated one number, the RNG is off and running using past results to calculate new numbers.

When the players starts a game by pressing the Spin button or pulling the handle on a machine, the program running the slot needs to use the output from the RNG to determine where to stop the reels. The program polls the RNG (that is, gets the most recently calculated value) and uses the number to calculate the stopping positions.

The program could use one number from the RNG to determine where to stop all reels. Let's say the machine has three reels with 64 virtual stops on each reel, for a total of 262,144 combinations. The program would scale the number from the RNG to the range 0 to 262,143 using modulo arithmetic (X mod 262,144) and then decompose the result into three separate numbers in the same way you convert from decimal to hexadecimal.

Most slot programs, however, poll the RNG once for each reel on the machine. On our machine, the program polls the RNG to get a number for the first reel. The program scales the number to select the virtual stop for the first reel. The program then polls the RNG again to get a number for the second reel. And it polls the RNG one more time to get a number for the third reel.

Best of luck in and out of the casinos,
John

Send your slot and video poker questions to John Robison, Slot Expert, at slotexpert@comcast.net. Because of the volume of mail I receive, I regret that I can't reply to every question.

John Robison

John Robison is an expert on slot machines and how to play them. John is a slot and video poker columnist and has written for many of gaming’s leading publications. He holds a master's degree in computer science from the prestigious Stevens Institute of Technology.

You may hear John give his slot and video poker tips live on The Good Times Show, hosted by Rudi Schiffer and Mike Schiffer, which is broadcast from Memphis on KXIQ 1180AM Friday afternoon from from 2PM to 5PM Central Time. John is on the show from 4:30 to 5. You can listen to archives of the show on the web anytime.

#### Books by John Robison:

The Slot Expert's Guide to Playing Slots
John Robison
John Robison is an expert on slot machines and how to play them. John is a slot and video poker columnist and has written for many of gaming’s leading publications. He holds a master's degree in computer science from the prestigious Stevens Institute of Technology.

You may hear John give his slot and video poker tips live on The Good Times Show, hosted by Rudi Schiffer and Mike Schiffer, which is broadcast from Memphis on KXIQ 1180AM Friday afternoon from from 2PM to 5PM Central Time. John is on the show from 4:30 to 5. You can listen to archives of the show on the web anytime.

#### Books by John Robison:

The Slot Expert's Guide to Playing Slots