[NBLUG/talk] Request for help--how to program shuffling

Steve Zimmerman stevetux at sonic.net
Tue May 20 18:32:00 PDT 2003


> On Tue, 20 May 2003, Andru Luvisi wrote:
> [snip]
>
> > Here is a standard way to shuffle an array.  Sorry, I can't remember this
> > algorithm's official name and my references are at work.  If you are
> > creating an online casino you will want a much better random number
> > generator.
>
> [snip]

_Data Structures and Other Objects Using C++_ says to 
analyze the process of doing something by hand to get
clues as to how to program.

What observations do we make re: shuffling?  Primarily
that shuffling is a process that is dependent on the 
_inability_ of the shuffler to order the cards.

Taken in a sort of meta-programming way, there's the
problem: in trying to program a shuffle, I have been trying to 
_order_ the cards in a random way.

Therefore, *a truly random shuffle would prevent the
programmer from ordering the cards in any way whatsoever,
either randomly or non-randomly!*

This would solve the problem you mentioned in an earlier
post--the observation that 52! (the number of possible 
orderings of 52 different cards) is way greater than
( 2^33) - 1, which is the 32-bit RAND_MAX.

I'd be interested in reading any errata you may find in
this post   : )     ....as well as any other comments you
may have.

Respectfully submitted,



More information about the talk mailing list