Part 1 – Random Online Casinos
In order for a computer to arrive at a number, you must tell it exactly how to arrive at that number. In doing so, you can give the computer other numbers, operators (addition, subtraction, multiplication, etc), and formulas. For example; you could tell the computer to start with the number 2, perform a torourous set of operations on it, and it would give you the result (lets say 25). No matter how complicated the instructions you gave the computer, every time you tell it to start with 2 it will always give you 25 back. Obviously in order for top online casinos to simulate blackjack (or any other casino game) they must have some way of making different combinations of cards come up each time you play.
How Do Random Number Generators Work?
The only way to get a different result from the computer (still following the 2 & 25 example) is to tell it to start it with a different number. This is preceisely what (pseudo) random number generators do. Instead of telling the computer to start with 2 the RNG might tell the computer to check your computer’s clock and use whatever number the second hand is at. This would lead to 60 different possible outcomes (there are 60 different numbers the second hand might be at). This is certainly better than nothing, but not something you’d be able to base an online casino off of. Players would quickly learn that hitting deal at just the right time would always net them a winning hand.
Another method might be to use a number like Pi (3.1415926535897932384626433832795028841971…). Pi is an example of an “irrational” number. This means if you were to write out say the first 1,000,000 digits of Pi you would not find any repeating pattern in the digits. In fact, no matter how many digits of Pi you wrote out the series would never begin to repeat itself. Using an efficient algorithm a computer can crank out the first billion digits of Pi in very little time. Going through the first billion digits of Pi would be a great way to generate random numbers. Unfortunately this plan would fail for an online casino if one of the players ever found out about it. It might take the player a while to figure out the formula for how the digits taken from Pi were used to determine the cards on his screen, but as soon as he did he’d be able to predict future cards and have a huge advantage over the house! Another way it might fail would be if the digits of Pi just happened run in such a way that they gave the player more winning hands than usual.
The actual method used to calculate pseudo random numbers is sort of a combination of these two methods. First a “seed” is generated by checking the computer’s clock, or some other number the computer has access to that is constantly changing. This seed is then used to pick a point in the number sequence to jump in at. For example if the seed was 624,053 the RNG might jump to the 624,053th digit of Pi and begin using numbers from this point on. Even if one of the players knew his BJ hands were somehow related to the digits of Pi it would be more difficult to find how they were related if he had no idea where in the sequence he was.
So Is Pi Commonly Used To Generate Random Numbers?
I don’t believe so. In fact it’s not very convenient for a computer to have to keep track of a billion different numbers just to generate pseudo random numbers. Instead what usually happens is that a complicated formula is used to calculate a “random” number from the initial seed. This “random” number is then plugged right back into the same formula (as if it were the seed) to generate another “random” number. This second “random” number is also put through the same formula to generate a third “random” number. This process is repeated every time another “random” number is desired. How well this process works depends on the function used. If a poor function is used you might see a sequence like:
0.99743, 0.65031, 0.10550, ….(skip 1,000 numbers)…, 0.96523, 0.65031
What wrong with this sequence is that one of the numbers has repeated. Since the next random number is determined by the last number generated the next number in the sequence above would have to be 0.10550. Then after another 1,002 numbers the cycle would repeat itself again. Repeating cycles are a bad thing because an alert player might be able to use it to predict the outcome of his bets, or even worse the 1,000 blackjack cards corresponding to these numbers might lead to a larger percentage of hands in which the player wins than usual. There are a lot of other things that can go wrong with these pseudo random number generating functions, but they all lead to the same problems:
- The player is able to predict the sequence, or
- The sequences tend to favor the player or the house.
Why would an online casino be very interested in how good their RNG is? For the game of blackjack I can’t imagine too many casinos caring if they discovered that their RNG formula was slightly biased against the player.
Part 2 – More About Online Casinos Random Number Generators
On the other hand, let’s consider the game of roulette. If the RNG function was slightly biased such that the number 9 tended to come up more often than any other number, this could cost the casino if a player ever discovered it. In fact any bias would favor the player in roulette if he knew about it. Because of this a RNG function must be thoroughly tested before being used in casino software. Now let’s consider a more subtle case. There are really only so many biases an online casino can test for and if they really wanted to eliminate them all they’d probably never find a usable RNG function. A subtle bias might be something like 0 showing up more often than expected on all spins following a 9. Perhaps there are many different subtle biases like this that would let any player make a killing if they were aware of them. It’s interesting that although a biased wheel could be a real problem for a land casino these subtle biases only effect online casinos. Of course an online casino could easily overcome such problems by making their software “non-random” (i.e. “invincible mode”) at times against the player.
If online casinos use a fair RNG why won’t they release the formula they’re using to prove it?
Going back to the roulette example, it would be almost impossible for a player to find subtle biases in the game. It’s not unthinkable for the pattern 9, 0 to emerge a few times in a roulette session consisting of a large number of spins. In fact if you were to record a few thousand spins you’d find several number pairs that showed up more frequently than others. Whether this is because of a true subtle bias, or simply chance is difficult to say. The only practical way a player could find subtle biases would be to experiment with the casino’s RNG formula. It wouldn’t be hard to write a computer program to simulate 1,000,000,000,000 roulette spins at a given casino if you knew their RNG formula and then to analyze the data in search of such subtle biases. This is one of the reasons online casinos might not want to reveal their RNG formulas.
If an online casino is using a fair RNG why would they need to change the formula?
One obvious reason would be that the RNG wasn’t really fair to begin with or that they wanted to “rig” their casino. Another possibility relates to the subject of subtle biases. Even thought most online casinos will test their RNG functions against a battery of “randomness tests” passing these tests doesn’t insure the function is completely without bias. If a year after releasing their software they discover a subtle bias they might have missed before or they notice a player is winning in a way that seems suspicious it might make sense to slightly modify the RNG formula to destroy the biases. Yet another possibility would be that the casino was in a rush to get their software to market. Because of this they settled for a less than perfect RNG function that failed some randomness tests. It was the best they had at the time and now that they’ve had some more time to develop a superior function they would like to use the new function.
Is there any way for a computer to obtain truly random numbers?
There’s a debate in philosophy over whether such a thing as “free will” (usually thought of as unpredictability) exists or whether our world is a deterministic one. I’m not going to touch this debate, but instead consider “true random numbers” simply to be numbers that cannot be predicted by another person using any mathematical formula.
The answer to this question is yes. Encryption programs commonly obtain truly random numbers by asking the user to type a sentence using the keyboard. By measuring the time between each keystroke essentially random numbers can be obtained. Unfortunately this solution isn’t really feasible for online casinos unless they want to employ people to randomly press keys all day long. Another novel approach involves radioactive decay. A geiger counter is an instrument that creates an electrical current every time a charged particle passes through its sensor. Since the time between each radioactive decay (which shoots off a charged particle) in a given material is unpredictable the bursts of current through a geiger counter is also unpredictable. Based on the type of material it is possible to say on average how much time will pass between each decay, but it’s impossible to predict exactly how long it will be between two particular decays. Hooking a geiger counter up to a computer would be an ideal method for determining random numbers.