Card Shuffling
Technical Information

Poker Mavens 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

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

Help Index | Home Page