Make sure your slot machine has a good pseudorandom number gen

  • Thread starter Thread starter scottdave
  • Start date Start date
  • Tags Tags
    Machine
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
13 replies · 2K views
TL;DR
Here's a 22 minute podcast about how some Russian "hackers" figured out how to cheat some slot machines.
In this NPR podcast (Planet Money) they describe how the cheaters figured out the pseudorandom number generators in a certain model of slot machine. I found it interesting and entertaining.
 
  • Like
  • Informative
Likes   Reactions: Tom.G and .Scott
Physics news on Phys.org
I listened to that, and it was interesting. Thanks for sharing.

This is naive, amateur ideas about random and encryption are always naive. But why do they use a pseudo random number generator in the first place?

We could have a 24 bit counter driven by a 1024 K Hz oscillator. The counter would cycle every 16 seconds. The "random" number would be the instantaneous clock value at the instant that the lever was pulled. No human could time their muscle movement with 1024K precision.

That is fundamentally different than a computational algorithm because the non-repeatability of human muscle movement is the basis.
 
  • Like
Likes   Reactions: Klystron
anorlunda said:
We could have a 24 bit counter driven by a 1024 K Hz oscillator. The counter would cycle every 16 seconds. The "random" number would be the instantaneous clock value at the instant that the lever was pulled.
Really?
 
anorlunda said:
We could have a 24 bit counter driven by a 1024 K Hz oscillator. The counter would cycle every 16 seconds. The "random" number would be the instantaneous clock value at the instant that the lever was pulled. No human could time their muscle movement with 1024K precision.
No, but if you were aware of the cycle you could certainly bias the results within a small enough range to distort the odds significantly in your favour. You would need a much smaller cycle time for this to work, perhaps 1ms, which would limit the range of values to c. 1,000 with a 1MHz oscillator.
 
pbuk said:
You would need a much smaller cycle time for this to work, perhaps 1ms, which would limit the range of values to c. 1,000 with a 1MHz oscillator.
I don't see where the cycle (wrap) time comes into play. The result is changing 1024 K times per second.

Each 2n possible bit values must map to a 3 digit selection of m possible slot machine symbols. As long as 2n >> m3, n doesn't matter much.
 
anorlunda said:
As long as 2n >> m3, n doesn't matter much.
That would be true but a typical modern casino machine might have 5 reels with 50 symbols on each so it's going to take ## \dfrac{50^5}{1,024^2} \mathrm{s} \approx 5 \mathrm{min} ## to cycle through the combinations.
 
pbuk said:
That would be true but a typical modern casino machine might have 5 reels with 50 symbols on each so it's going to take ## \dfrac{50^5}{1,024^2} \mathrm{s} \approx 5 \mathrm{min} ## to cycle through the combinations.
Interesting. But even if it did take 5 minutes, what is the probability of a user timing his pull exactly enough to hit one of the winners? Each number is active for only 1/1024K seconds, about one microsecond. Isn't that the important part? Not the time to cycle all possibilities.

So even if I know a winner is due in about 1 second from now, what is the probability I can hit the exact microsecond ?
 
anorlunda said:
So even if I know a winner is due in about 1 second from now, what is the probability I can hit the exact microsecond ?
Not great, but even with 1 second accuracy in 5 minutes you can improve your odds by a factor of 300.
 
anorlunda said:
This is naive, amateur ideas about random and encryption are always naive. But why do they use a pseudo random number generator in the first place?
In some cases that's part of a legally mandated professionally code-reviewed strategy for making the return rate (the 'hold' percentage) predictable and settable.
 
  • Like
Likes   Reactions: pbuk and anorlunda
scottdave said:
I had thought of the idea of randomly pulling a number from the clock, but not to get the actual random number, but to seed a pseudorandom generator.
That's a not-uncommon PRNG tactic.
 
sysprog said:
In some cases that's part of a legally mandated professionally code-reviewed strategy for making the return rate (the 'hold' percentage) predictable and settable.
It would have been more accurate had I said "the retention level(s)" instead of "the return rate" -- in the vernacular of slot machine gaming, the 'hold ' percentage is the percentage retained; not the percentage returned.
 
  • Like
Likes   Reactions: anorlunda
sysprog said:
In some cases that's part of a legally mandated professionally code-reviewed strategy for making the return rate (the 'hold' percentage) predictable and settable.
I think you nailed it. Whatever the shortcomings, a PRNG algorithm can be analyzed and its characteristics well characterized. Better more random schemes might be implementation dependent and thus hard to analyze and prove.