Pokerstars RNG details

    • gavinonymous
      gavinonymous
      Bronze
      Joined: 18.12.2008 Posts: 1,146
      I was wondering about the pokerstars RNG, and found a few details - some of it is a bit much for me to understand. Thought it might be worth a post

      SHUFFLE

      We understand that a use of a fair and unpredictable shuffle algorithm is critical to our software. To ensure this and avoid major problems described in [2], we are using two independent sources of truly random data:

      * user input, including summary of mouse movements and events timing, collected from client software
      * true hardware random number generator developed by Intel [3], which uses thermal noise as an entropy source

      Each of these sources itself generates enough entropy to ensure a fair and unpredictable shuffle.
      Shuffle Highlights:

      * A deck of 52 cards can be shuffled in 52! ways. 52! is about 2^225 (to be precise, 80,658,175,170,943,878,571,660,636,856,404,000,000,000,000,000 ways). We use 249 random bits from both entropy sources (user input and thermal noise) to achieve an even and unpredictable statistical distribution.
      * Furthermore, we apply conservative rules to enforce the required degree of randomness; for instance, if user input does not generate required amount of entropy, we do not start the next hand until we obtain the required amount of entropy from Intel RNG.
      * We use the SHA-1 cryptographic hash algorithm to mix the entropy gathered from both sources to provide an extra level of security
      * We also maintain a SHA-1-based pseudo-random generator to provide even more security and protection from user data attacks
      * 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:
      o we take 5 random bits and convert them to a random number 0-31
      o if this number is greater than 25 we just discard all 5 bits and repeat the process
      * This method is not affected by biases related to modulus operation for generation of random numbers that are not 2n, n = 1,2,..
      * To perform an actual shuffle, we use another simple and reliable algorithm:
      o 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
      o 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
      o we repeat the process until all cards have moved from the original deck to the new deck
      * This algorithm does not suffer from "Bad Distribution Of Shuffles" described in [2]

      PokerStars shuffle verified by Cigital and BMM International

      PokerStars submitted extensive information about the PokerStars random number generator (RNG) to two independent organizations. We asked these two trusted resources to perform an in-depth analysis of the randomness of the output of the RNG, and its implementation in the shuffling of the cards on PokerStars.

      Both independent companies were given full access to the source code and confirmed the randomness and security of our shuffle. Visit Online Poker Random Number Generator for more details.
  • 11 replies
    • timukasr
      timukasr
      Bronze
      Joined: 26.05.2007 Posts: 1,820
      I have heard that your preflop, flop, turn action influences the next street (cause it's so random?). Like if you call preflop the flop will be J :heart: T :club: 3 :spade: but if you fold then flop would be different (or random) like 2 :heart: 3 :heart: A :club: , anybody can confirm this?
    • simm1
      simm1
      Bronze
      Joined: 16.06.2009 Posts: 127
      If they use the method gavonimous say, then yes it would be a different board if you click 1 second later.

      so nice, then i can blame some fish for not doing somehting if i dont hit, or if they suck out, i will blame it that they cheat, and click mouse at a time so they would hit! :P
    • VirtuaGod
      VirtuaGod
      Bronze
      Joined: 09.02.2009 Posts: 514
      Originally posted by simm1
      If they use the method gavonimous say, then yes it would be a different board if you click 1 second later.
      That's just stupid...

      Edit: stars not you lol
    • cyzo
      cyzo
      Bronze
      Joined: 19.07.2008 Posts: 117
      That is also not how it works. The random input is taken from before the hand starts. They then produce a deck in a random order based upon that input, and use that deck throughout the hand.
    • elhh82
      elhh82
      Bronze
      Joined: 03.09.2008 Posts: 6,838
      yeap, it should work just like your home game.

      You shuffle the deck pre-deal and it should stay the same throught the hand. No matter what happens.
    • deVall3y
      deVall3y
      Bronze
      Joined: 06.01.2009 Posts: 554
      Originally posted by timukasr
      I have heard that your preflop, flop, turn action influences the next street (cause it's so random?). Like if you call preflop the flop will be J :heart: T :club: 3 :spade: but if you fold then flop would be different (or random) like 2 :heart: 3 :heart: A :club: , anybody can confirm this?
      not exactly clear, but from what I understand, the decks are shuffled and then the cards are dealt when the time is right so anything you do after they are shuffled doesnt matter. thats how I programmed my poker software anyway :f_cool:
    • lennonac
      lennonac
      Global
      Joined: 02.05.2009 Posts: 1,421
      Originally posted by cyzo
      That is also not how it works. The random input is taken from before the hand starts. They then produce a deck in a random order based upon that input, and use that deck throughout the hand.
      Thats not true at all, the deck is shuffled everytime there is a user input.

      As computers cannot create true random and it would be too easy to sync a home made rng if it only shuffled once.
    • swissmoumout
      swissmoumout
      Bronze
      Joined: 23.02.2007 Posts: 3,385
      Originally posted by lennonac
      Originally posted by cyzo
      That is also not how it works. The random input is taken from before the hand starts. They then produce a deck in a random order based upon that input, and use that deck throughout the hand.
      Thats not true at all, the deck is shuffled everytime there is a user input.

      As computers cannot create true random and it would be too easy to sync a home made rng if it only shuffled once.
      Did you even read the OP?
    • MikeB570
      MikeB570
      Bronze
      Joined: 25.05.2009 Posts: 72
      I'm positive that FTP shuffles the deck constantly (but they do not use user input) but I'm not sure about Stars. From what I read it seems like it doesn't say.
    • gavinonymous
      gavinonymous
      Bronze
      Joined: 18.12.2008 Posts: 1,146
      To me it looks like they use the random input from users and other 'random' natural measurements to set the seed for the next shuffle. Once the cards are dealt they are going to come out that way, but it's near impossible ever predict, hack or cheat it I suppose. This sucks, because it doesn't let you off the hook for folding quads or something.

      Just heard from a friend a live hand at a casino PL hold'em, half hour into the session. KK, flop AAK, turn K river J. Opponent with AA wins the pot. What are the odds? About 4.6E-07 ouch!
    • Alverine
      Alverine
      Bronze
      Joined: 31.01.2009 Posts: 1,938
      I think pokerstars is the only platform inform us intesively how they use rng. Any other site describes this subject in a very brief way.



      Off topic
      Originally posted by cyzo
      That is also not how it works. The random input is taken from before the hand starts. They then produce a deck in a random order based upon that input, and use that deck throughout the hand.
      @cyzo: hey, need to talk to you. Get in skype or accept me in in the community board.