View Single Post
  #10  
Old 10-01-2007, 10:06 AM
Freyalise Freyalise is offline
Junior Member
 
Join Date: May 2007
Location: U.K.
Posts: 28
Default Re: Shuffling at sites

[ QUOTE ]
I always thought poker stars shuffled for every card but then I saw this today in the WCOOP main event chat:


snake8484: is the flop preset ? or does the deck continue to shuffle the remaining cards until the player presses call or fold etc
[...]
HostMarkW [Support]: the deck is only shuffled once at the start of the hand


Maybe they had changed the method.

Do you know how it is?

And what networks have continuous shuffling (shuffling for every card) and what networks shuffles the deck before all the cards are dealt so the flop etc. would be the same regardless of action?

[/ QUOTE ]

The actual method we use to shuffle is described in
great detail on this page:

http://www.pokerstars.com/poker/room/features/security/

Let's cover that in detail, step by step, from the "Shuffle
Highlights" section:

> We use 249 random bits from both entropy sources (user input and
> thermal noise) to achieve an even and unpredictable statistical
> distribution.

So, to shuffle a hand, we take 249 truly random bits from the thermal
source, and 249 truly random bits from the aggregate mouse movements --
two truly random (not pseudo-random) sources.

> We use the SHA-1 cryptographic hash algorithm to mix the entropy
> gathered from both sources to provide an extra level of security

Thus, we use a mathematical formula to combine these two different 249
bit numbers into a single 498 bit number. Now we have a binary stream
of units and naughts, something like this:

01010111100101100111011010001000101011110101010101 1010101010101011...

It's much longer than that in reality (498 bits), but you get the idea.

The page then says:

> To convert random bit stream to random numbers within a required
> range without bias, we use a simple and reliable algorithm. For
> example, if we need a random number in the range 0-25:
>
> - we take 5 random bits and convert them to a random number 0-31
> - if this number is greater than 25 we just discard all 5 bits
> and repeat the process

Finally, we use that method to do the actual shuffle:

> To perform an actual shuffle, we use another simple and reliable
> algorithm:
>
> - first we draw a random card from the original deck (1 of 52)
> and place it in a new deck - now original deck contains 51
> cards and the new deck contains 1 card
>
> - then we draw another random card from the original deck (1 of
> 51) and place it on top of the new deck - now original deck
> contains 50 cards and the new deck contains 2 cards
>
> - we repeat the process until all cards have moved from the
> original deck to the new deck

So, how does it work? First, we need a number from 0 to 51 to get one
of 52 available cards. To get such a number, we need 6 bits. (I'm
assuming you know at least a little bit about binary numbers here
since you said it was a "technical" discussion). We take the first
six bits of our much larger stream of random bits, and never use them
again:

01010111100101100111011010001000101011110101010101 1010101010101011...
010101 (use these)

11100101100111011010001000101011110101010101101010 1010101011...
(these are what's left)^^^^^^^^^^

If that number is from 52 to 63, we discard it as too large. If it is
between 0 and 51, we use it to choose the card. In this case, 010101
is our six bit number, and it is "21", so we choose card 21 as the
first card.

We continue down the bitstream as needed. We now need 0 to 50 (51
cards left), and the next six bits are 111001, which is 57:

------11100101100111011010001000101011110101010101101010 1010101011...
------111001 (use these)
01100111011010001000101011110101010101101010101010 1011...
(these are what's left)^^^^^^^^^^

We discard that as too large and continue with the next six bits,
011001, or 25. And so on.

Each time the number of cards is reduced, the number of bits we need
can drop, too. Here's a table showing how many bits of data we need
to choose from N remaining cards:

52 = 6 bits needed 35 = 6 bits needed 18 = 5 bits needed
51 = 6 bits needed 34 = 6 bits needed 17 = 5 bits needed
50 = 6 bits needed 33 = 6 bits needed 16 = 4 bits needed
49 = 6 bits needed 32 = 5 bits needed 15 = 4 bits needed
48 = 6 bits needed 31 = 5 bits needed 14 = 4 bits needed
47 = 6 bits needed 30 = 5 bits needed 13 = 4 bits needed
46 = 6 bits needed 29 = 5 bits needed 12 = 4 bits needed
45 = 6 bits needed 28 = 5 bits needed 11 = 4 bits needed
44 = 6 bits needed 27 = 5 bits needed 10 = 4 bits needed
43 = 6 bits needed 26 = 5 bits needed 9 = 4 bits needed
42 = 6 bits needed 25 = 5 bits needed 8 = 3 bits needed
41 = 6 bits needed 24 = 5 bits needed 7 = 3 bits needed
40 = 6 bits needed 23 = 5 bits needed 6 = 3 bits needed
39 = 6 bits needed 22 = 5 bits needed 5 = 3 bits needed
38 = 6 bits needed 21 = 5 bits needed 4 = 2 bits needed
37 = 6 bits needed 20 = 5 bits needed 3 = 2 bits needed
36 = 6 bits needed 19 = 5 bits needed 2 = 1 bit needed
1 = 0 bits needed

If you add up all the bits you get (you guessed it) 249 -- the number
of bits we take from each of our truly random entropy sources.

Since we start with DOUBLE the number of truly random bits needed (249
each from thermal and user inputs), this is enough to ensure that even
if we have to discard every other group of bits as "bigger than the
maximum number we need", we have enough truly random bits to complete
the shuffle.

Thus, there isn't really a "seed". That's a concept that applies only
to pseudo-random generators. When you refer to a "seed" you mean the
first, initial number fed to the pseudo-RNG, from which flows all of
the following numbers in a mathematical progression. If you know the
seed, and know the mathematical formula, you can get the Nth number in
a pseudo-RNG progression by running that formula on the seed, and then
the result, and then that result, N times.

That doesn't happen at all with our method. At PokerStars, NOTHING is
ever pseudo-anything, and nothing is ever "seeded". The next number
doesn't depend on the prior one and there's no mathematical formula
one can use to figure out the next number. Every time we choose
the "next card to go into the randomly shuffled deck", the choice is
truly random and not the result of a pseudo-random number generator.

Once randomized, the order of the deck is
never changed throughout the deal. The cards that come out on any
given round are totally independent of any player action.
Reply With Quote