Positively Nerd Street

Random Number Generators for Dummies

Created By: Sean Lind Posted in: Positively Nerd Street, Poker Gadgets and Technology
2009 Aug 20
random numbers

Ever wondered how poker sites randomly shuffle the deck? Here's everything you need to know about RNGs, but were too afraid to ask.

Before we get into the generators, the first step in understanding how a poker site shuffles its decks is to understand what the word random actually means. The actual definition of random is very simple:

Random = impossible to be predicted.

Computers can only do what they're told to do. Until full-functioning artificial intelligence becomes a reality, a computer is a slave to the person operating it.

A computer cannot create, or think for itself. It can only be given a set of instructions and return the results from following them.

Does not Compute
(0100010001101111011001010111001100100000011011100110111101110100
0010000001000011011011110110110101110000011101010111010001100101)

The very first computer ever created ran on a series of switches. It would do different things depending which switches were on (1) or off (0). The first computers used physical, hand-modulated switches (just like you use to turn on the light in your living room).

As computers progressed, the switches became electronic, and computers went from processing a handful of switches a second to billions.

This is what's known as binary, 1's and 0's. All regular computers today still run on this simple system; everything you do on a computer can be broken down to a series of ones and zeros.

In fact the text title of this section (Does not Compute) is represented in binary by the series of ones and zeros next to it (eight digits for every letter).

Because computers working like this, everything a computer does has to be based on logic. 1+1 always equals 2, unless the computer is instructed otherwise.

A computer can't randomly choose a number, because when a computer is asked to pick a random number, its response is "How should I do that?"

As soon as you have to tell the computer how to select a random number, the number is no longer random.

Fake Random Numbers

lava lamp
The movement of a Lava Lamp: impossible to predict.

In the scientific world, fake random number generators are known as Pseudo-Random Number Generators (PRNGs).

The majority of random number generators used by computers are not truly random. They are a number created by a programmed algorithm. Basically, you take a sophisticated mathematical algorithm, and use its result as your random number.

For those of you who know anything about math, you need to start with a number to put into the algorithm to be able to get anything out as a result. This initial number is known as the seed. A basic simple seed used by many PRNG's is using the system's internal clock to pick its number.

The problem with this approach is its vulnerability to be cracked. If anyone can get their hands on (or figure out) your algorithm, and the method for finding your seed number, they will be able to predict the identical random numbers with 0% error.

Obviously, this would be a mistake for a poker site, as it would allow anyone who can figure out its algorithm to compromise the game. Although these sorts of RNGs can be useful for non-crucial tasks, such as video games, they're not suitable for true security.

True Random Numbers

Although it's possible to argue that it's impossible to be truly random, it's absolutely possible to get very close. Close enough that it is impossible (using any technology available today) to predict the number generated.

To achieve this level of random, computers must find a seed which is, in itself, random. This is done by measuring a physical occurrence, or reaction, which happens naturally at random.

For example: measuring radioactive decay, thermal noise or even the movement of a lava lamp.

When using a system such as this, even if someone obtains your algorithm, they will still be unable to reproduce your results, without somehow managing to monitor the same source for the seed numbers.

Where Poker Comes in

Poker sites shuffle the deck randomly, using the random numbers their RNGs create. Every major poker site has outside experts evaluate the state of its RNG, to make sure the RNG is in fact creating unpredictable results.

Although some sites give out more information than others, all poker sites post public information about their specific RNG in use:

Single Shuffle versus Continuous Shuffle

shuffle
Practise enough and even a hand shuffle isn't random.

Once you're confident that all poker sites use a valid RNG, making its shuffles unpredictable, the next thing to know is that there are two types of shuffling used by poker sites.

The single shuffle is the equivalent to a hand-shuffled physical deck. It's randomly shuffled, cut, then dealt. Once dealing has started, the deck remains intact as it was after the last shuffle.

Although this technique is the most "pure," it's not the only way a poker site can choose to operate. Some poker sites choose to add one more layer of security by using a continuous shuffle.

This means after every card is dealt, the deck is constantly being shuffled before every new card to be dealt. This layer of security makes it almost impossible to know what card will be dealt next.

Should You Worry About Online Security?

Let me put it this way: If any person can create a way to crack a true RNG, that single idea alone will bring them more wealth and fame than they could ever gain from cheating at poker.

It would be a creation worthy of a field's medal, and would become the backbone of all military code-breaking operations.

It would be the single biggest thing to happen in the computing world since the invention of the microchip. If you invented such a thing, you would have two choices:

  • Cheat at poker to become Phil Ivey-rich, while constantly having to hide and worry about being caught as a cheat.
  • Sell the idea to the military to become Bill Gates-rich, while at the same time becoming a national hero and computing god.

Which would you choose?

Comments

8
  1. Eric

    2009-08-22

    I have been trying to find a calculator that will tell me the odds of a particular deal. Let me just give it to you and maybe you can direct me to the right calculator or give me the odds yourself. I was dealt Ksp-Jd. Flop came Kcl-7sp-Jh. Three handed, everyone went all in. I found I was up against K-K and J-J. Obviously drawing dead. My question is: what are the odds of those cards being dealt? I thought I had a pretty good shot hitting top two pair.

  2. gunner274

    2009-08-28

    How does a computer use a lava lamp to get a random seed number? I don't get how that works

  3. Sean Lind

    2009-08-28

    Eric, I hate to say it, but I'm not really sure how to rock that math. It's a little more difficult than figuring out the odds of one hand hitting to figure out both.

    Either way it's extremely small. I feel it's about 1/1900 or so, this is just a ballpark. If anyone here knows how to do this math, feel free to comment.

  4. Sean Lind

    2009-08-28

    gunner,

    The computer uses a video feed of the lava lamp, monitoring a specific area of the lamp. Each time it needs a seed it take a snapshot of the lamp at that moment, and uses an algorhythm to turn the image into a number. This can be done in a number of ways, the simple of which being a simple pixel count.

    the % of pixels with the exact color of the lava lamp goo compared to not. Something like that.

  5. Jason

    2009-09-23

    Assuming you know the 3 hands pre-flop (KK + JJ + KJ), the odds of a dealt flop including the remaining KJ are 1 in 345. Using the "choose function" for combinations, there are 46*45*44/6 unique flops. There are 44 possible flops that include KJ (KJ plus any of the remaining 44 cards from the deck as the third card). 46*45*44/6/44 = 345 / 1.

    The odds of KJ, KK, and JJ being dealt pre-flop can be computed similarly (although it's more complicated). If we assume there are just 3 players, the odds are 1.27 million to one. Each added player makes the odds go up significantly--with 4 players, the odds are 357 thousand to one. Going beyond 4 players is too hard to do by hand with a calculator -- I'd need to write a program. Of course, that's assuming you're specifically looking at KJ -- there are similar scenarios, like AK vs AA and KK, which further increase the odds. It's probably not nearly as unlikely as you think.

    Play enough online, and you'll eventually run into this. The most unlikely hand I've ever seen was when the board ran out a straight flush, which is 7.8 million to one against.

    Next time, maybe fold the KJo preflop? It was a marginal hand to begin with, especially against a pre-flop raise, which I assume there must have been.

  6. Brad

    2009-11-11

    I like the Droste effect used in the image for this article. Did you create it? If so, what app did you use?

  7. Sean Lind

    2009-11-11

    Brad,

    Hey, that picture is not my own work. If I'm not mistaken It's from the creative commons section of Flickr.

    I couldn't find it again, otherwise I'd link you.

  8. Lugubre

    2009-11-13

    To Jason:

    You're wrong about the straight flush. The odds for the board running out a straight flush is 64,973 to 1 against.

    The board can run out 52x51x50x49x48 / 5x4x3x2x1 different 5-card hands, which totals 2,598,960 hands.

    Since there are 40 different straight flush combinations (10x4) when the 4 royal flushes are included the board will run out a straight flush 1 time in 2,598,960 / 40 = 1 time in 64,974

Leave Your Comment

Bloggers

IGC - Interactive Gaming Council IGASA - Certified Poker Publisher