Finding the current RNG value
The LCG PRNG (Linear Congruential Generator Pseudo Random Number Generator) algorithm is generally characterized as easily predictable. This means that just by knowing 3 random numbers you are able to calculate a, c, m parameters and easily predict the next numbers in the sequence.
Alex already knew a, c, and m parameters from the decompilation, but he didn’t know the current RNG (Random Number Generator) state value. He was able to observe the produced random numbers indirectly by watching the positions where the reels stopped in recorded spins.
The key point is that logic of a slot game is deterministic and programmed inside the cabinet. So it can be decompiled, reverse-engineered and simulated somewhere else. The game logic usually takes a random number and uses some mathematical operations to determine where each reel should stop.
The slot machine reels usually have around 50 to 100 symbols, three of which are displayed on the screen. The combinations may sometimes repeat, and reels can have a different length, but let’s assume that there are 50 unique combinations on each reel. The random number selects one of these 50 combinations, so just by looking at the first reel in the first spin you can eliminate 49/50 (98%) of potential random numbers.
If you know the outcome of many consecutive random numbers, then you’ll very soon end up with just 1 initial random number which gives the desired outcome for all spins. In fact, the number of spins you need is proportional to the length of the initial random number.
So you just need to simulate all the possible random numbers and... If a slot machine used random numbers which are 64 bits long, then simulating all of them would require too much computational power. So, Alex still needed to get a little unintentional help from Aristocrat’s developers:
- Use a RNG state that is too short (32-bit).
- Use the random number in a way that it can be used to help find the current RNG state.