Good day:

I happen to be very familiar with this subject, having developed, analyzed
and qualified two different card-shuffling algorithms for real-money play
in the online card game business.  There is a fair bit of literature on
this subject.

Some tips that I can share without breaking an NDA:

1) Do not use current time other than as an _adjunct_ to initial seeding
of a quality PRNG.  Under OpenBSD, you can obtain a good initial seed from
/dev/?random, so why bother using time at all?

2) Use of a hardware device (HRNG), such as the SG-100 from Protego
(Sweden) or motherboard HRNG is preferred to a PRNG, as its state cannot
be observed in memory.

3) Qualify the quality of your random seed if it is coming from an HRNG. 
Some of these things have "warm-up time" and will initially produce poor
entropy.

4) Do not use the % (modulo) operator to select a card.  The residues from
% introduce small amounts of bias, and this is a disqualifying factor for
regulated gaming.

5) Knuth's "Art of Computer Programming" has an algorithm for fairly
shuffling cards.  Unfortunately it assumes perfect floating-point math,
which a computer cannot really do.  The algorithm, however, is worth
studying.

CHEERS

-- 
Jack Bates
Venice, CA, USA
I play Texas Hold'Em at http://www.fulltiltpoker.com

Reply via email to