Re: Card dealing and random repetition
- From: rossum <rossum48@xxxxxxxxxxxx>
- Date: Thu, 05 Jan 2006 23:46:24 +0000
On Wed, 04 Jan 2006 10:42:04 +0100, Schraalhans Keukenmeester
<none@xxxxxxxxxxx> wrote:
>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.
Have a look at L'Ecuyer: "The basic underlying generator for this
implementation is a combined multiple recursive generator with period
length of approximately 2^191"
From: http://or.pubs.informs.org/Media/L'Ecuyer.pdf
rossum
--
The ultimate truth is that there is no ultimate truth
.
- Prev by Date: Re: debate: to get a Master's Degree in CS or Not
- Next by Date: Re: debate: to get a Master's Degree in CS or Not
- Previous by thread: Re: Card dealing and random repetition
- Next by thread: What programming language to choose : Challenge for real experts here !
- Index(es):
Relevant Pages
|