Generating Good Random Numbers for Production Environments


Mission Objective:

Design a shuffling algorithm which ensures seeds used in the RNG solution are truly random within the constraints of a poker game.

The Procedure:
To come up with a good shuffling algorithm, we decided two things are required. First, you need a good pseudo random number generator. Second, you need a high quality source of entropy. In designing our system, we gave serious consideration to using a hardware entropy source but concluded it isn't good enough and not as reliable as we'd like.

Implementation:

When designing a shuffling card algorithm, one of the most important issues is making sure you have valid random entropy sources. The debate became: "how do we pull good sources of entropy from a software driven system?" What we came up with was: "Why not pull random entropy sources from each client connected to the local table?" By gathering entropy sources from each client, we could mesh this into the main entropy seed; our reasoning was, with a couple of clients we'd be able to generate a very good source of entropy per table.

Now the question was, what source of entropy would be read from each client's computer. After short debate we decided the best source of entropy we could get from each client would be the user's mouse position (since it's always moving) and the current millisecond clock time on their computer's system-time. To ensure that the data is very random and our entropy seeds are "fresh with live data", we collect these "seeds of entropy" several times per minute. Now that we've generated a good source of entropy for the seed associated with each poker table, we must find a pseudo random number generator that is extremely fast and provides us with random numbers of very high quality.


Finding The Right Random Number Generator:

We decided the best pseudo random number for our needs would be a Mersenne Twister . The Mersenne Twister is a pseudorandom number generator which was developed in early 1997 and provides fast generation of very high quality random numbers.

The Mersenne Twister takes input data which should be quite random and it will return back a true random number (which will be used to shuffle all 52 cards). Basically the more random your input data is, the better your seed is going come out. This will result in a better shuffled deck.

So before a new deck is shuffled, we use a Mersenne Twister. The data we provide it with is all this new entropy seed data we've collected from all the clients and the server's local chipset Timer Stamp Counter.

Doing this helps to ensure that the cards dealt out are truly random and not weighted in any direction; and next to impossible to guess. And we don't just shuffle the deck once! The Timer Stamp Counter is constantly changing several times per nanosecond, so we have the deck shuffled over 10 times to ensure that the cards you get truly are random to your poker-table - and well shuffled!


Conclusion:

By revealing our shuffling algorithm, we hope that you can get a better understanding of some of the measures we use to ensure the integrity of your online poker gaming experience.

We hope you enjoyed this brief description of the shuffling algorithm procedure we use. Thanks, and we're looking forward to see you on our tables!

And now for our plug!

Come visit us at www.crystalpoker.net , download our software, tell your friends & family, play a few hands of poker and Join The Fun :)

Different Versions of the text above:

 

 

Home Security Shuffling Algorithm Contact Us Our Blog Jobs About Us     
Copyright © 2008, CrystalPoker.net. All Rights Reserved.