Re: Card dealing and random repetition



I though about something while reading your post.
Have you ever seen someone shuffle a deck? it's quite interesting, and inspiring for an 'elegant' way to simulate a shuffle.
example 1 : Poker dealer "show off"
The dealer divide the deck in two parts, trying to make them equally big (but I estimate the error margin being between 1 to 5 cards from the count of 26 cards per half-deck). Then he shuffle them trying to alternate 1 card from the right-half-deck and one from the left-half-deck (here there is a slight probability of 2 card staying stuck together and not being separated during the shuffle, the probability of 3 staying unseparated is even slighter and 4 cards is nearly impossible if the dealer is good at this) by bending the cards and releasing each deck next to each other.Then repeat 1 to 3 time and then deal.
SO doesn't it look simple to emulate in a program?
Take your array of 52 cards.
Divide it in 2 sub arrays, with a random error of 1 to 5 cards difference.
Shuffle : adding a random probability of the next card on the array being picked instead of the next of the other array. This probability go decreasing if this already happened in the previous card.
Repeat it as much as you want.

I think this method looks funnier. Could it have any utility? It's a direct emulation of the real-world card shuffling.


Schraalhans Keukenmeester ha scritto:
Most rand() implementations, even the more sophisticated PRNG's
are limited to 32 or 64 bits at best. Given the fact that they will always produce identical series given the same seed, it follows the randomizer repeats itself after max. 2^32 cq 2^64 numbers.

If you shuffle a deck of 52 cards, there are 52! different decks to end up with, or 8.0658175170943878571660636856404e+67 different possibilities.

(I did an experiment, not exhaustively, but I manually shuffled a deck of cards, created an array with the same card order and shuffled a deck continuously and kept track of how many cards in the shuffled deck matched the order in the 'test' array. To my shock & horror after more than a 100 billion shuffles I had only the first three cards matching. Quite bizarre! Note: I may have had more matches, but I only count rom the top, and quit when the first non-matching card is found)

I know several poker/bj-sites brag about using true random seeds each run, I still think that if there are 'just' 2^64 (18446744073709551616) possibilities there are no more than that number of ways the resulting deck is shuffled. Or am I wrong?

I'd say, only if you (RANDOMLY) reseed the randomizer between each card picked there is a chance you will eventually exhaust the possibilities.

How would one get around this problem without resorting to a true random source?

Your help/insight is very welcome.
.



Relevant Pages

  • Re: portably shuffle a deck
    ... this cannot portably shuffle a deck, ... RNG schemes). ... the cards up using a set of shuffle techniques that are more or ...
    (comp.lang.c)
  • Re: I pee in the open
    ... But humans also don't start with a new ordered deck ... probably per game just to make sure all the cards are there. ... These things will add some randomness. ... people don't shuffle perfectly, so randomness only occurs on a scale ...
    (alt.lang.asm)
  • Re: Quote of the day
    ... grand proclamations to the effect of "I have super high standards that ... I have never seen anyone cut the cards in all the ... Frankly I don't recall if I ever cut the deck but having reasonable ... deck blackjack table style shuffle). ...
    (rec.games.bridge)
  • Re: Card dealing and random repetition
    ... >If you shuffle a deck of 52 cards, ... >(I did an experiment, not exhaustively, but I manually shuffled a deck ... >of cards, created an array with the same card order and shuffled a deck ... only if you reseed the randomizer between each card ...
    (comp.programming)
  • Re: my deck of cards (once again)
    ... That module already has methods to shuffle a deck, deal cards out to ... then push it on to the array in a different ...
    (perl.beginners)