Friday, August 14, 2009

Online Poker The Random Number Generator

As many people are aware, online poker rooms (as well as any online gambling site) uses what is called a random number generator to produce what would appear to be a random outcome in each hand.

This article will explain the Random Number Generator (also called Pseudo-Random Number Generator, PRNG or RNG). The purpose of this article is to familiarize players with the 'inner workings' of the software used in the Online Poker rooms and the way cards are produced in a deal.

The use of a RNG is nothing new, as it actually dates back hundreds of years before the computer was even conceived. Mathematicians as early as the 1700's used a random number process to try and determine outcomes of specific problems.

The advent of the computer presented a challenge for scientists and programmers wanting to produce a seemingly random action from the computer, and therefore an assembly code language function was implemented called RAND also known as randomize and RND. This function would be attached to a program and assigned a variable to select a random number.

However, the program required a 'seed' number to begin its process of selecting what would appear to be a random number, otherwise it would produce the same series of numbers each time the program ran. Therefore, early programmers used the timer function on the CPU in order to produce a different series of seemingly random numbers each time the program ran.

This was somewhat acceptable and appeared to produce a different random result each time. However, after several thousand runs of the program, it became easier to 'predict' what series of numbers would come out. This gave a challenge to programmers to find a way to actually produce what would seem to be a truly random result, one that could not be predicted or repeated in any short course of time.

Ultimately, a mathematical method was derived that gave the RNG's a better way to produce a more realistic way of generating random numbers. In addition, experiments using white noise generators to produce the seed were also successful. Both of these among other secondary methods to produce a seemingly random result are used today in all major Online Poker rooms.

Now for the DEAL!

How does that affect the deal of cards, you may ask. Well, actually, the modern RNG programs are more beneficial then the software used several years ago. The sophistication of the randomness is better for the player, because the predictability of a card is much harder, and the RNG is designed to curtail cheating. However, it is not the best method and has many failures.

The Major Fail

A standard 52 card deck has a total number of possible combinations of 80,658,175,170,943,878,571,660,636,856,404,000,000,000,000,000,000,000,000,000,000,000,000

Thats a BIG number, in fact, there is no name for a number that large except to say it is 8 times 10 to the 67th power.

What this means is that if you lay out all 52 cards in order, that is one possible combination of the deck, you shuffle the cards and lay them out again, they obviously are in a different order, and that would be a second combination, repeat this process and each time you would get a different sequence or combination of cards laid out on the table. It would require a minimum 8 times 10 to the 67th power 'deals' to repeat the exact same sequence of cards.

In essence, a deck of cards is ideally suited to an RNG because of the endless variety of combinations of a deck. However, there is no possible way any computer in existence has the ability to store every combination (it would require at the bare minimum a 256 bit processor and a whole lot of speed!) and since most servers use only a 32 or 64 bit architecture they are only able to process a small fraction of all possible combinations.

Two Pigeons; One Hole

This is known as the Pigeonhole Principle, wherein the theorem states that there does not exist an injective function on finite sets whose co-domain is smaller than its domain. In other words, you can not put two objects into a container that is physically only able to hold one object.

So what happens to the billions of possible deck combinations? Simple, they are never used, processed or even appear in the online poker RNG. They do not exist as far as the program is concerned.

In reality, out of the 8x10^67 possible combinations only about 4 billion deck combinations are used in a 32bit architecture. This greatly reduces the number of possible hands you can make, and also is a basic explanation as to why there are so many bad beats and made hands in online poker.

For this reason, you will notice more straights, more flushes and more often full houses appear at showdown. The program, by reducing all the possible combinations down to less than 1/20^58, now forces a lot of action and produces a lot of big hands, because it strips away all the outer-dimensional deck combinations. (How often do you see high card, one pair or two pair win?)

In conclusion, the RNG used in online poker is never able to truly produce a random deck or outcome, simply because the program does not use all possible combinations of decks. There are other reasons the deck may be stacked against you and we will explore those in upcoming articles.

I hope this article is helpful to you in understanding how the RNG produces a 'random' deck of cards and invite you to subscribe or bookmark this blog to learn more about online poker.

This post is intended to give a brief oversight of some of the inner workings of the online poker RNG, in the next post, I will explore how the RNG can actually be manipulated to your advantage.