April 16th, 2021 at 9:33:52 AM
permalink

I stumbled upon this paper which - in my opinion is one of the most verbose papers about slot machines and how they work internally. it describes the math and most importantly the random number generation process

https://gaming.unlv.edu/reading/Pacyniak.PDF

https://gaming.unlv.edu/reading/Pacyniak.PDF

April 16th, 2021 at 10:29:43 AM
permalink

I didn't see anything about the actual "random number selection process" - just how it converts a random integer to a result.

I also noticed this:

"Dropping a coin or hitting the button happens at a random time and the chances are very small that one can hit a particular number even if you knew it was about to come because the computer is generating numbers at a rate of about 1000 or more cycles per second."

It had better be far more than 1000 cycles per second; I have seen documentation of people able to push a button within 1/10,000 of a second of a known upcoming event (i.e. some sort of pointer approaches a certain point, and the button is pressed when the pointer is within 1/10,000 of second of that point).

There is an algorithm to generate "random" numbers in cycles (i.e. in each group of N consecutive numbers, each number from 0 to N-1 comes up once): start with any number from 0 to N-1, and then replace each number X with (X * m + a) mod N, where m and a are integers that meet these conditions:

1. a is relatively prime to N (i.e. their greatest common factor is 1)

2. (m - 1) is a multiple of every prime factor of N

3. If N is a multiple of 4, then (m - 1) is also a multiple of 4

For example, to generate numbers from 0 to 999,999 (N = 1,000,000), a can be anything other than a multiple of 2 or 5, (m - 1) is a multiple of both 2 and 5, and since 1,000,000 is a multiple of 4, m - 1 must be a multiple of 4; this means m can be any number that is 1 more than a multiple of 20, and a can be any number ending in 1, 3, 7, or 9.

In the case of a power of 2 (for example, N = 16,777,216 is mentioned in the paper), a can be any odd number, and m can be any number that is 1 more than a multiple of 4.

Of course, some of these are more random than others; the pattern 0, 1, 2, 3, 4, ..., 999,999 contains every number once.

Also note that the numbers cycle in the same pattern. This could be a problem if they are not generated fast enough. For example, assume the probablilty of hitting the jackpot is 1 / 50,000,000. Even if you generate 100 million numbers per second, you know that the jackpot number comes up once every 1/2 second exactly; this could be used to increase the chance of winning severely. One alternative is to use a much larger cycle, and take only the "high order bits"; for example, to get a number from 0 to (2^24 - 1), you generate numbers from 0 to (2^40 - 1) and use only the leftmost 24 bits of the result. Each of the 2^24 numbers appears the same number of times in each cycle of 2^40, but they are not equally separated. (If you use the rightmost 24 bits, they would still be equally separated.)

I also noticed this:

"Dropping a coin or hitting the button happens at a random time and the chances are very small that one can hit a particular number even if you knew it was about to come because the computer is generating numbers at a rate of about 1000 or more cycles per second."

It had better be far more than 1000 cycles per second; I have seen documentation of people able to push a button within 1/10,000 of a second of a known upcoming event (i.e. some sort of pointer approaches a certain point, and the button is pressed when the pointer is within 1/10,000 of second of that point).

There is an algorithm to generate "random" numbers in cycles (i.e. in each group of N consecutive numbers, each number from 0 to N-1 comes up once): start with any number from 0 to N-1, and then replace each number X with (X * m + a) mod N, where m and a are integers that meet these conditions:

1. a is relatively prime to N (i.e. their greatest common factor is 1)

2. (m - 1) is a multiple of every prime factor of N

3. If N is a multiple of 4, then (m - 1) is also a multiple of 4

For example, to generate numbers from 0 to 999,999 (N = 1,000,000), a can be anything other than a multiple of 2 or 5, (m - 1) is a multiple of both 2 and 5, and since 1,000,000 is a multiple of 4, m - 1 must be a multiple of 4; this means m can be any number that is 1 more than a multiple of 20, and a can be any number ending in 1, 3, 7, or 9.

In the case of a power of 2 (for example, N = 16,777,216 is mentioned in the paper), a can be any odd number, and m can be any number that is 1 more than a multiple of 4.

Of course, some of these are more random than others; the pattern 0, 1, 2, 3, 4, ..., 999,999 contains every number once.

Also note that the numbers cycle in the same pattern. This could be a problem if they are not generated fast enough. For example, assume the probablilty of hitting the jackpot is 1 / 50,000,000. Even if you generate 100 million numbers per second, you know that the jackpot number comes up once every 1/2 second exactly; this could be used to increase the chance of winning severely. One alternative is to use a much larger cycle, and take only the "high order bits"; for example, to get a number from 0 to (2^24 - 1), you generate numbers from 0 to (2^40 - 1) and use only the leftmost 24 bits of the result. Each of the 2^24 numbers appears the same number of times in each cycle of 2^40, but they are not equally separated. (If you use the rightmost 24 bits, they would still be equally separated.)

April 16th, 2021 at 12:27:51 PM
permalink

Quote:ThatDonGuyI didn't see anything about the actual "random number selection process" - just how it converts a random integer to a result.

to me this was the most mysterious part about a slot machine and i thought it was part of the RNG process until now

April 16th, 2021 at 8:03:25 PM
permalink

In the pdf paper, the author repeatedly speaks of "loosing" which should be spelled as "losing." So this paper has had no editorial or content review (because this would have been caught.)

So many better men, a few of them friends, are dead. And a thousand thousand slimy things live on, and so do I.

April 16th, 2021 at 8:03:28 PM
permalink

In the pdf paper, the author repeatedly speaks of "loosing" which should be spelled as "losing." So this paper has had no editorial or content review (because this would have been caught.)

So many better men, a few of them friends, are dead. And a thousand thousand slimy things live on, and so do I.

April 17th, 2021 at 7:58:16 AM
permalink

That paper reads to me like that of a Doctoral student writing their dissertation.

I nice overview but I really didn't see anything new in it.

I nice overview but I really didn't see anything new in it.

Order from chaos

April 17th, 2021 at 11:13:18 AM
permalink

Quote:DRichThat paper reads to me like that of a Doctoral student writing their dissertation.

I nice overview but I really didn't see anything new in it.

Im kind of dumb so i saw through the grammar. I was never able to find the mapping of the numbers part in such dumbed down plain language