RANDOM NUMBER GENERATOR / SHUFFLING

» Read the Gaming Associates Certification Letter here [pdf]

Random Number Generation and Shuffling

The Scarlet Poker software has been tested and certified by Gaming Associates, one of the most respected groups in software certification. A critical aspect of any card game is the random shuffle of the deck. We take this very seriously and want to share with you our approach. The two critical aspects are the use of unpredictable random numbers, and the approach to ensuring a random and unpredictable ordering of the deck.

Random Numbers

We use the random number generator (RNG) available from the Linux operating system. This is an entropy-based RNG. [I.]

The random number generator uses (collects) noise from the system, device drivers and other sources such as network activity and CPU utilization, into an entropy pool. From this entropy pool random numbers are created. Linux provides the /dev/random device. Reading this device from code provides random numbers. [II.]

Our approach is to take seeds from that pool on a periodic basis. These seeds serve as the starting number for an elementary cellular automaton [III.]. A cellular automaton in our case is an array of binary values. A complex rule for state transitions creates new random numbers from the seed value. We use a rule known to produce randomness. "Rule 30 is of special interest because it is chaotic... this rule is used as the random number generator used for large integers in Mathematica." [IV.]

Once we have that seed, we produce random number through the state transitions of the cellular automaton. Our cellular automaton has 256 bits. We take the additional step of randomly selecting one (1) bit from each of the successive 255 rows (states) to produce our random numbers.

Our random number generator passed two (2) standard tests: the Diehard [V.] and the ENT tests [VI.]. More importantly, our code has been inspected and certified by Gaming Associates [VII.], an independent testing lab specializing in the analysis, review, and certification of software for gaming and cryptology.

Shuffling

A random number generator is only part of the story in producing randomly distributed decks of cards. How the deck is shuffled is equally important. We have selected an algorithm (process) that ensures a true randomizing shuffle. This approach does not favor any one card or any one position in the deck.

We then assign each card a 256 bit random number. This very large number is greater than 1 with 77 zeros after it. With each card given its own huge random number, we sort the deck by those random numbers, placing the cards in yet another random sequence. This algorithm also ensures that every possible card sequence is theoretically equally likely to occur.

Summary

Our approach relies on well-accepted random number generation tools, relying on system entropy to generate random seeds. We then use a system known to generate randomly distributed numbers from the seed number. As a further security step, we periodically select a new seed. Our decks are randomized prior to first use, and then serve as the random base from which a randomizing shuffle is applied.

FOOTNOTES

  1. Entropy : a measure of the disorder or randomness in a closed system.
  2. Based on material in the Linux manual entry for Random.
  3. mathworld.wolfram.com/ElementaryCellularAutomaton.html
  4. Ibid.
  5. en.wikipedia.org/wiki/Diehard_tests
  6. www.fourmilab.ch/random
  7. www.gamingassociates.com