PDA

View Full Version : Differences in random number generators


11-22-2005, 01:07 PM
I was playing AP last night, and some one wrote that the different poker sites have different random number generators. Now I am not saying that this affects your "luck", but is this true? I thought this type of program was pretty straight forward. I am pretty sure I was supposed to write one once in college, but I dropped the class.

My question is, are the sites different in how the random card orders are generated? Not that I think it makes difference in win/loss %, but just curious.

cardcounter0
11-22-2005, 01:19 PM
No, they are all the same. There is only one random sequence of numbers, and there is only one method to generate it.

Rudbaeck
11-22-2005, 01:56 PM
Yes, they are.

The bad sites use software algorithms to generate the seed, based on some rather deterministic pseudo-random seed. These, while better than they were a decade ago, are still kinda bad.

The good sites use a completely random physical device as seed, usually thermal noise. Or if they are cool and spendy radioactive decay. Both are actually, physically, random.

Now this has little practical effect, as even the bad method is about a billion billion times as random as the best Vegas dealer. It's just a question of how many billion billion times as random they are.

(Unless, ofcouse, someone fubars badly and manages a rerun of the Planet Poker fiasco of half a decade ago.)

waffle
11-22-2005, 02:35 PM
stars uses a physical device. party doesn't, they use sun's SeedGenerator which gets entropy from the machine's VM, i think

waffle
11-22-2005, 02:35 PM
[ QUOTE ]
No, they are all the same. There is only one random sequence of numbers, and there is only one method to generate it.

[/ QUOTE ]

you don't know anything about computing.

cardcounter0
11-22-2005, 02:38 PM
If (select sarcasm from waffle) is NULL then call displaygrin();

/images/graemlins/grin.gif

OrcaDK
11-22-2005, 02:50 PM
[ QUOTE ]
If (select sarcasm from waffle) is NULL then call displaygrin();

/images/graemlins/grin.gif

[/ QUOTE ]

Syntax error. That should be

if(waffle.sarcasm == null) {
displayGrin();
}

cardcounter0
11-22-2005, 02:59 PM
You mean there is more than one programming language???

SELECT A.RECNAME,
A.FIELDNAME,
decode(B.FIELDTYPE, '0', 'CHAR', '2', 'NUMERIC', '3', 'DECIMAL', '4', 'DATE', 'NA') as TYPE,
' x ',
B.LENGTH,
C.LONGNAME
FROM PSRECFIELDDB A, PSDBFIELD B, PSDBFLDLABL C
WHERE A.RECNAME in
('MASTER_ITEM_EC',
'INV_ITEMS_EC',
'ITEM_VENDOR_EC',
'ITM_VNDR_LOC_EC',
'ITM_VNDR_UOM_EC',
'ITM_VNDR_UMPR_EC',
'PUR_ITM_ATTR_EC',
'INV_ITM_UOM_EC')
AND A.FIELDNAME = B.FIELDNAME
AND C.FIELDNAME = A.FIELDNAME
AND C.DEFAULT_LABEL = 1
ORDER BY 1, 2

Kablooie
11-22-2005, 03:16 PM
Let us all bow to the Lords of Kobol...

krimson
11-22-2005, 03:35 PM
The RNG's used by poker sites may be different, but they all produce the same result...

BruinEric
11-22-2005, 03:35 PM
I'll reply to your query with a post from my website/blog. All links are removed per 2+2 site policy, but I think this reply applies.

Any clarifications, etc. from the wise heads here are welcome.

The below is meant to be an elementary explanation. It is my understanding that several sites actually "shuffle" the "remaining cards" between rounds of betting.

Bottom line: the major poker sites have hardware-based RNGs along with a numerically robust shuffling algorithm. This definitely results in ZERO predictability, and if the RNGs are audited properly should result in ideal randomness, which would mean that any undealt card has an equal chance of being dealt next.

To see how an RNG and the shuffling algorithm can be flawed (albeit unintentionally) look up the story about Planet Poker from 1999. Google these words: PLANET POKER CRACKED and you can get several articles that explain what happened.


----

Basics of Online Shuffling

This is part of an ongoing series about whether the Cards you're dealt in Online Poker are fair.

In this post, I'm going to try to give a very simplified explanation of how cards are shuffled in online poker rooms. This is a topic that can get very complex.

The goal of a shuffle is card randomization. The player needs to know that any unused card has an equal probability of being dealt next as any other unused card. But in the case of playing cards, random does not mean there are infinite possibilities.

Since a deck of cards has 52 cards, there are a limited number of orderings possible. The number is extremely large, but it is not infinite. If you ever took a higher-level math or statistics class, you'll know about factorials. The number of possible deck orderings is 52-factorial -- noted as 52! This number is around 130,000,000,000,000,000,000,000,000,000,000,000,00 0,000,000 -- a very large number indeed.

At the beginning of a hand, a software algorithm picks one of those decks and deals out the hand. So far, that part seems pretty simple. If a software program can get a random number and pick a deck from that number of possibilities and do this honestly and accurately, we must admit that this meets our criteria for a fair game.

For a little more detail, I'll quickly summarize how Paradise Poker accomplishes this.

The first step is getting a truly random number. This can actually be a bit more difficult than it seems. Here is how Paradise Poker handles this:

[ QUOTE ]

We have two main sources of these random bits. First, the rng on the server samples the low order bits of the CPU's time stamp counter (667MHz) at irregular parts of the program and when data is received from client connections, and uses it to add to the entropy in our large seed.


Secondly (and mainly) the client programs send their own 32-bits of entropy with every action they make and with several of the other packets they send to the server. The client's entropy is gathered from both mouse and keyboard movements, as well as the lower 32-bits of their CPU time stamp counters.


[/ QUOTE ]

From all this random gobbledygrokdata, they get a 2016 bit seed and use their 31-bit random function shuffling algorithm to generate a shuffled deck.

If all of this is implemented correctly, you truly do have a completely unpredictable deck that meets our critera for a fair deal.

To learn more about how Paradise Poker shuffles their cards, click HERE.

Zetack
11-22-2005, 04:39 PM
[ QUOTE ]
I'll reply to your query with a post from my website/blog. All links are removed per 2+2 site policy, but I think this reply applies.

Any clarifications, etc. from the wise heads here are welcome.

The below is meant to be an elementary explanation. It is my understanding that several sites actually "shuffle" the "remaining cards" between rounds of betting.

Bottom line: the major poker sites have hardware-based RNGs along with a numerically robust shuffling algorithm. This definitely results in ZERO predictability, and if the RNGs are audited properly should result in ideal randomness, which would mean that any undealt card has an equal chance of being dealt next.

To see how an RNG and the shuffling algorithm can be flawed (albeit unintentionally) look up the story about Planet Poker from 1999. Google these words: PLANET POKER CRACKED and you can get several articles that explain what happened.


----

Basics of Online Shuffling

This is part of an ongoing series about whether the Cards you're dealt in Online Poker are fair.

In this post, I'm going to try to give a very simplified explanation of how cards are shuffled in online poker rooms. This is a topic that can get very complex.

The goal of a shuffle is card randomization. The player needs to know that any unused card has an equal probability of being dealt next as any other unused card. But in the case of playing cards, random does not mean there are infinite possibilities.

Since a deck of cards has 52 cards, there are a limited number of orderings possible. The number is extremely large, but it is not infinite. If you ever took a higher-level math or statistics class, you'll know about factorials. The number of possible deck orderings is 52-factorial -- noted as 52! This number is around 130,000,000,000,000,000,000,000,000,000,000,000,00 0,000,000 -- a very large number indeed.

At the beginning of a hand, a software algorithm picks one of those decks and deals out the hand. So far, that part seems pretty simple. If a software program can get a random number and pick a deck from that number of possibilities and do this honestly and accurately, we must admit that this meets our criteria for a fair game.

For a little more detail, I'll quickly summarize how Paradise Poker accomplishes this.

The first step is getting a truly random number. This can actually be a bit more difficult than it seems. Here is how Paradise Poker handles this:

[ QUOTE ]

We have two main sources of these random bits. First, the rng on the server samples the low order bits of the CPU's time stamp counter (667MHz) at irregular parts of the program and when data is received from client connections, and uses it to add to the entropy in our large seed.


Secondly (and mainly) the client programs send their own 32-bits of entropy with every action they make and with several of the other packets they send to the server. The client's entropy is gathered from both mouse and keyboard movements, as well as the lower 32-bits of their CPU time stamp counters.


[/ QUOTE ]

From all this random gobbledygrokdata, they get a 2016 bit seed and use their 31-bit random function shuffling algorithm to generate a shuffled deck.

If all of this is implemented correctly, you truly do have a completely unpredictable deck that meets our critera for a fair deal.

To learn more about how Paradise Poker shuffles their cards, click HERE.

[/ QUOTE ]

This is all crap. What actually occurs is that there is a team of card shufflers. One of the shufflers shuffles a deck and then puts it in a scanner which reads the order of the deck. This deck is then used for the next table that needs cards. The shuffler meanwhile shuffles again and puts the new deck into the scanner and so on.

To speed the process up, each shuffler uses more than one deck, so he can shuffle a deck while the first deck is being read by the scanner. The only difference between sites is that each site uses a different number of decks per shuffler.

So basically, the online decks are exactly as random as the live ones.

Luckily, labor is fairly cheap in most of the off-shore countries where poker sites are based.

Hope this helps.

--Zetack

BradleyT
11-22-2005, 07:05 PM
They also taught all shufflers the Antonio One Handed Shuffle which speeds things up considerably.

waffle
11-22-2005, 07:21 PM
oh, damn. my sarcasm detector is broken. n1

11-22-2005, 11:27 PM
[ QUOTE ]

Any clarifications, etc. from the wise heads here are welcome.


[/ QUOTE ]

You miss a key point and miscontrue the process.

Key point: they do not pick a random deck and deal from it. They deal random cards from a deck, with new randomness injected at each stage where cards are randomly drawn. It's not random decks being chosen; it's random cards.

The Paradise page is a little confusing in that regard. They start by noting that most sites use [ QUOTE ]
either a single-pass full Knuth shuffle, or an incremental Knuth shuffle (which is essentially the same, but does the work as cards get dealt).

[/ QUOTE ]

They don't clarify at this point that they use an incremental approach, but their comment at the end makes it clear:
[ QUOTE ]
The updated seed is used for dealing cards during each card dealing round

[/ QUOTE ]
As you know, several rounds of cards a dealt in a single hand.

The key here is that there is time for random data to be injected into the seed between rounds of cards. That means that the seed is different when the flop is dealt than when the first two cards are dealt, and it's different again when the turn is dealt.

Party accomplishes the same thing in a different way -- there are central random servers generating streams of random numbers, and tables which need to deal cards pull random numbers from the stream at the time they are needed.

In either case, two critical facts emerge:

1. Because timing and other random factors affect future cards in the very same hand, you can not use the currently dealt cards and knowledge of the random functions in use to determine future cards. I've written about this on this Random Number Generator Wiki page. (http://overcards.com/wiki/moin.cgi/RandomNumberGenerator)

2. This also means that you can't tell what "would have happened" if you stayed in a hand vs. folded. If you went back in time and made a different play, the different timings, movements, server delays, etc., would result in a different random card being dealt for the turn and river. This is unlike B&M poker, where the turn and river cards are pre-determined when they shuffling is done. It's also healthier for poker players! I wrote about that on a wiki page called Free Your Mind (http://overcards.com/wiki/moin.cgi/FreeYourMind).

The right way to play poker is to decide based on the current situation (cards on the board, cards held) and all the POSSIBLE next cards. The wrong way to play is to decide whether you were right based on the card that actually came. If you fold JJ against an AK7 board, the fact that a J fell on the turn does NOT mean that you were wrong "this time." You are NOT sure you would have turned a set. If the river comes down a J as well, it does not mean you "would have had quads!" If you had stayed in, the turn card would have been different. The chances that you would have turned a set were about 2 in 47, regardless of the fact that you saw a J come down.

jman220
11-22-2005, 11:46 PM
[ QUOTE ]
The RNG's used by poker sites may be different, but they all produce the same result...

[/ QUOTE ]

2/7 offsuit always beats pocket aces!

BruinEric
11-23-2005, 01:42 AM
Good stuff. I'm surprised you only have a few posts here -- good to see you over here too.

I know Full Tilt uses the 'shuffling during the hand' method from comments by Howard Lederer, but since the Paradise summary was unclear to me at best on this point, I chose to take the simplest possible method (deck chosen at beginning of hand and set until hand completion) and use that as my elementary introduction to the topic.

If an algorithm can truly support selection of all 52! decks, then either method is truly random and the cards are not predictable. Even after a player sees his hole cards and 3 flop cards, there would still be 47! possible card orderings for the unseen cards. Any predictability from a set deck at the beginning of a hand is still impossible.

I will make a few edits to the article, thanks.

Zetack
11-23-2005, 11:20 AM
[ QUOTE ]



In either case, two critical facts emerge:

1. Because timing and other random factors affect future cards in the very same hand, you can not use the currently dealt cards and knowledge of the random functions in use to determine future cards. I've written about this on this Random Number Generator Wiki page. (http://overcards.com/wiki/moin.cgi/RandomNumberGenerator)

2. This also means that you can't tell what "would have happened" if you stayed in a hand vs. folded. If you went back in time and made a different play, the different timings, movements, server delays, etc., would result in a different random card being dealt for the turn and river. This is unlike B&M poker, where the turn and river cards are pre-determined when they shuffling is done. It's also healthier for poker players! I wrote about that on a wiki page called Free Your Mind (http://overcards.com/wiki/moin.cgi/FreeYourMind).



[/ QUOTE ]

For party and paradise perhaps. I would note that Stars deck is set at the beginning of the hand, the cards that come off are the ones you would have gotten if you'd stayed in.

--Zetack

11-23-2005, 11:02 PM
Poker Stars doesn't actually specify whether they use complete decks or not.

In their method, a random card is drawn from the original deck and added to the "new" deck. If ten people are dealt in for a hand, then can use this method to generate a deck of 20 cards, representing the deal, and then wait while the first round of betting is played, allowing more entropy from user movement and their thermal generators before the 11, 12, and 13th random cards are drawn into the new deck.

The advantage of a method like that is that the cards are not just unknown, but impossible to know until it's time for the actually dealing. This makes it completely impossible for someone to compromise the server and learn what cards will flop.

The programmatic mechanics are the same either way.

The only reason I can think of to complete a deck before dealing from it is to appease people who may be offended by the fact that the cards are not all decided beforehand, like "real poker." Most people are content to be ignorant of how it works, as long as the cards are random and fair.

11-24-2005, 01:45 AM
[ QUOTE ]
2. This also means that you can't tell what "would have happened" if you stayed in a hand vs. folded. If you went back in time and made a different play, the different timings, movements, server delays, etc., would result in a different random card being dealt for the turn and river. This is unlike B&M poker, where the turn and river cards are pre-determined when they shuffling is done. It's also healthier for poker players! I wrote about that on a wiki page called

[/ QUOTE ]

How come some sites give you the option to Rabbit Hunt then? Poker.com does it. Does this mean the Rabbit hunt isnt really what would have been dealt?

11-24-2005, 03:59 AM
[ QUOTE ]
How come some sites give you the option to Rabbit Hunt then? Poker.com does it. Does this mean the Rabbit hunt isnt really what would have been dealt?

[/ QUOTE ]

Because some people love to rabbit hunt, and the poker sites try to cater to them. You can allow rabbit hunting whether or not the card is already "decided." If the river hasn't yet been selected, and the hand is over, and the winner decides to rabbit hunt, just have the code spit out one more random card. Whether the card was picked in advance or after the request makes no visible difference to the players -- it's impossible to tell by watching the game -- but the ones who enjoy it get to have their fun.

Personally, I think it's a little cruel to the suckers. They live and die not on what might happen, but on what did happen. If they fold 44 on the flop and see a river 4 would have won for them, they bitch and moan and try all the harder to stay in with 44 next time. Smart players look at the fact that someone else had JJ on the flop, and know they did the right thing by folding. Period. It doesn't matter what came on the river; the decision to fold the flop was correct.

teajay
11-24-2005, 09:23 AM
Yes, I'm being a nit but your "estimate" of 52! is severely flawed. You're off by a solid 23 digits (which accounts for LOTS of arrangements). Looks like you're dealing from a 38 card deck.

For completeness sake
52! =
80658175170943878571660636856403766975289505440883 277824000000000000

your original estimate
130000000000000000000000000000000000000000000

/images/graemlins/grin.gif

waffle
11-24-2005, 10:35 PM
kind of offtopic question: ok, now how many possible deals are there when we count multiple deals with a suit isomorphism as only one deal? this should eliminate a bunch.

BruinEric
11-25-2005, 04:44 AM
[ QUOTE ]
Yes, I'm being a nit but your "estimate" of 52! is severely flawed. You're off by a solid 23 digits (which accounts for LOTS of arrangements). Looks like you're dealing from a 38 card deck.

For completeness sake
52! =
80658175170943878571660636856403766975289505440883 277824000000000000

your original estimate
130000000000000000000000000000000000000000000

/images/graemlins/grin.gif

[/ QUOTE ]

That's a pretty freaking serious number screw-up on my part. I got that estimate from an article on deck possibilities. Yuck.