Lasse said:
You didn't misread then, that is the algorithm
If the period of the pseudo-random number generator is 2^32, then indeed,
it can at most generate 2^32 different shuffles, which is less than the
13! needed. I never thought of that restriction.
In fact, that restriction holds for any shuffling algorithm using a
PRNG with a period of 2^32.
If you can actually generate randomness enough to get 52! different
outcomes, this algorithm uses exactly that much, making each shuffle
equally likely.
Yes, there is a big difference between a statistically good PRNG, and
a cryptographically strong one (or so I have been told
.
/L
To add a left turn into the conversation, a human, using a typical
shuffle, splitting a deck in two, and joining them, cannot create all
52! outcomes either. It is really just a combination of the two piles,
based on a given deck state. You can shuffle more than once, and have
more combos, but still, not all combos are equally likely.
With that, if you want to simulate a (typical) human shuffle, you really
only need to have random numbers between 1 and 10, where 1,2,3 are more
likely than 10 (if you are en experienced shuffler). Then, you take a
given deck, split it in half (with a random deviance), and take random
ammounts from each side, one side, and then annother.
Then, do it one or two more times. This, to me seems more likely to be
a good shuffle algorithm for a card game. Oh yeah... dont forget to
split the deck
I did something like this, in a blackjack simulator... I wanted to test
betting techniques over a long period of time. I actually shuffled a
deck of cards about 20 times, and tallied up the probabilty of the
different card chunks that added together to a single deck. I found
that numbers such as 2 and 3 were much more common than 1 and 4, where 5
and 6 were practically unheard of. I used these stats to generate my
shuffle.
Ultimately, I scrapped the program, because it didn't deal with the many
factors that cannot be programmed, such as human emotion around the
table, and bad playing decisions on other player's parts. This threw a
mix into the final hand that made the my subtle shuffling algorithm
practically useless
Anyways, that is just a sidenote.
Brian