Contact Form

Shuffling Info

PokerHost uses a cryptographically secure shuffling algorithm for dealing cards. An RC4-based stream cipher seeded with a random 256-bit key is used as the random number generator. The key is produced by hashing a seed pool with the SHA-256 hash algorithm. The seed pool is constructed by sampling the CPU's 1.193 MHz high-performance counter. Those samplings occur each time the operating system communicates an internal message to the Server Module, which can be thousands of times per second and is also affected by interaction with the Game Administrator (mouse movements, key presses, etc.)

The deck is represented internally as an integer array from 1 to 52 with 1 representing the deuce of clubs and 52 the ace of spades. Before each hand, the array is shuffled using the highly efficient shuffling algorithm described in Donald Knuth's "The Art of Computer Programming" series of books. In Delphi, it looks like this:

for i:=52 downto 2 do begin k:=prng_value(i)+1;

The prng_value function returns a random number from 0 to i-1 from the secure random number generator described above.

Conspiracy theories often arise from newcomers (and some oldtimers) in online poker in regards to how many "big hands" they seem to observe, especially compared to live games that they may be more familiar with. If not an outright manipulation of the hands by the software, there must be at least something wrong with the program's shuffling algorithm and/or random number generator. These claims are usually just anecdotal and not backed up by any statistical analysis. Ignorance of card odds and mechanics of poker in general, Texas Hold'em in particular, how cards are shuffled in software, and plain old human psychology are major factors. This card simulation utility provides statistical evidence that no "funny business" is actually occurring.

It's human nature to only remember the occasional quads vs straight flush hands and forget about all of the thousands of high card vs pair hands that we see. Someone who learned poker by playing live probably never saw thousands of hands to begin with, as they were lucky to play 20 or 30 hands an hour in a game that got together maybe once a week. With online poker, you're probably playing 60 or 70 hands per hour and maybe several tables at once, any time you feel like it. You are going to see a lot of big hands that way, especially on play money or low stakes tables where everyone limps in preflop and calls all the way to the river. When the action is cheap, people want lots of it, especially when they are playing on instinct and have no idea about what the actual drawing odds are. There are a lot of poker hands that can be made with five exposed community cards and 9 or 10 pairs of hole cards on the table. Contrast this to a table of solid players that raise preflop with good hands and fold with poor hands and no flop was ever dealt. I recently heard poker pro Daniel Negreanu remark on television on an episode of "High Stakes Poker" that he personally had never made a royal flush in all of his years of playing. I personally have made a half-dozen royal flushes just playing on PokerStars for a few years. But that few years consisted of many hundreds of thousands of hands.

The mechanics of shuffling and dealing cards in software is not well understood by most non-programmers so what follows is a brief explanation. PokerHost represents a deck of cards simply as an array of numbers from 1 to 52. The 1 represents the deuce of clubs, the 2 the deuce of diamonds, on up to 51 as the ace of hearts and the 52 as the ace of spades. The order of the suits were selected alphabetically (clubs, diamonds, hearts, spades). The actual shuffling algorithm knows nothing about player cards, however. It simply shuffles the array of numbers so that each one is equally likely to end up in any of the 52 slots. This occurs before the hand even starts. It doesn't know that each number corresponds to a playing card, let alone in a poker game, let alone for Texas Hold'em, let alone who they are dealt to or to which table.

Once the shuffle occurs, the order of the cards is fixed until the hand is complete. The cards that a player gets is determined by the rules of Texas Hold'em. The software simply follows those rules and has no more say in the matter. It's all up to the players in how they play their hands and if there will be a flop, turn, or river card dealt. The first card in the deck goes to the first player clockwise from the button. The player on the button is the last one to get a card. Then that process is repeated for the second hole card. The next five cards will make up the community cards, if needed. PokerHost does not use burn cards. Note that a player leaving or joining the table completely changes the hands that will be made, as does a player sitting out in a ring game table since they are skipped. Also, if multiple tables are active, any particular table will get a different set of decks than if they were the only table running. As mentioned, the shuffling algorithm knows nothing of these particulars. Even a lousy shuffling algorithm would still produce equally looking random hands and couldn't create an usual number of "big hands" even if it wanted to.

What makes a good card shuffling algorithm are two main requirements: each card must have an equal chance of landing in any position in the deck, and the random number generator used by the shuffler must be unpredictable to a human observer so that they cannot determine the future order of the cards. PokerHost satisfies both of these requirements using the highly efficient shuffling algorithm described in "The Art of Computer Programming", a series of acclaimed books written by noted computer scientist Donald Knuth. The random number generator uses an RC4 stream cipher, designed by noted cryptographer Ronald Rivest. The stream cipher is seeded with a random 256-bit key, generated by hashing a seed pool with the SHA-256 hash algorithm. The seed pool is constructed by sampling the CPU's 1.193 MHz high-performance counter.