RPP algorithm from someone who knows what he's talking about

Warning: LONG post, but hopefully interesting.

Having played on RPP (and on no other internet poker sites) for a few months, I frequently see people say that RPP hands are not completely random and that the algorithm they use is lopsided or rigged. I figured I would chip in my two cents.

First, some background on me: I am a PhD student in statistics. I specialize in random variable simulation. This means, I am an expert in the following things:
A) What uniformly random arrangements of cards look like
B) How to test whether or not a certain process which creates arrangements of cards does so uniformly at random or not
C) How you would go about writing computer code in order to create a system which was rigged in one way or another

In other words: I know what I am talking about. Probably the only better qualification I could have would be if I had written the RPP algorithm myself, but in that case I would have a reason to lie to you. Since I didn’t, you can probably trust that this is honest.

While I have not actually done any formal tests, I can still be fairly confident in saying this: I am pretty sure the RPP algorithm is perfectly fair (GASP!)

Let’s talk about why:

The first thing you might suspect is that RPP didn’t rig the system out of malice, but because they just didn’t write very good code. This is an easy assumption to make, but let me tell you: Writing code to deal cards at random is VERY EASY. All you need is a good random number generator. Now of course, you might think that this means they don’t have a good random number generator, but the thing is, almost everything on earth uses the same generator. It’s called the mersenne twister. You can read about the details at https://en.wikipedia.org/wiki/Mersenne_Twister if you like. This is a prefabricated algorithm which is usually considered the standard. It has already been coded into hundreds of programming languages, so nobody really writes their own generator anymore, and they haven’t for years. The mersenne twister is VERY good. It is not truly random, but it is about as close as you can get. It is so close that there is no known statistical test which can tell the difference between truly random numbers and those that come from this algorithm. It is, in fact, a lot closer to true uniform randomness than shuffling a pack of cards by hand.

IF RPP has a system which is not uniformly random, then it was made that way on purpose. How hard it is to rig depends on exactly what you wanted to do. I have seen a bunch of specifics thrown around, so I am only going to talk about one of them (next couple of paragraphs), but overall, the conclusion is usually the same: Writing a rigged program is MUCH harder than writing a fair one . . . and all the money on RPP is fake, so why would you ever want to? Let’s go into a few of the specifics:

The claim that prompted me to write this was a guy who said “Pay attention to the RPP algorithm: If you are having a bad day at the ring games, try the sit-n-gos and you will do better”. This is similar to what many others have said. Let’s be clear: Actually coding something like this would be absurdly complicated. For starters, you have to keep track of exactly what kind of luck someone has been having at the ring games. You could either set this on purpose, or find a way to figure it out automatically from the cards. Setting it on purpose is much easier, but this means you have to set a level of luck for every single player on RPP. You can control that, of course, but you can’t control what table someone sits at. What if two guys sit at the same table and both are slated to have fantastic luck? You have to give the good cards to the guy that is slated for better luck I guess? And then you have to recalculate the adjustment for the level of luck of the other guy, because your plan was to give him good luck and you didn’t? Then you have to consider what switching between SNG and ring games does. Somehow you have to keep track of the fact that someone changed one system of play for the other and then adjust the luck they are slated to have based on that. All of this comes BEFORE you actually deal any cards, because when you do somehow you have to figure out a way to rebalance your entire card dealing algorithm for whatever combination of luck levels you see from everyone sitting at the table.

Could this be done? Yes, you could do it. But man . . . it would be HARD! Not only would this be hard to program to begin with, but this system would be ridiculously complicated to keep track of. All this extra work would take up disk space and CPU, require more maintenance, give the entire staff a lot more work, and all for what reason? I am doing something this complicated (even moreso, actually) for my PhD thesis, so it is definitely possible, but it has taken me years of hard work, and I am doing it in order to diagnose patients with diabetes: I am trying to save lives! If you are actually going to put that much work into something, you should probably have a much better reason than just to mess with the heads of some random people on the internet.

Now let’s talk about some other forms of broken randomness: There are a few that would be much easier to code, and I have seen people accuse RPP of a few of those: “Almost every flop contains an ace.” “Much higher incidence of good hands.” “Way too many pocket pairs”, etc. These ARE harder to code than just complete fairness, but not much harder, and you might even be able to argue that there is a reason for it: Show the beginners some strong hands to get them excited!

I decided to give a quick sanity check to the number of flops with aces: Complete randomness dictates that about 1/4 of flops contain an ace. You deal 3 cards in the flop, and each one of them has about a 1/13 chance of being an ace, so 1/13+1/13+1/13 is 3/13 which is close to 3/12=1/4. This is NOT the exact probability, since you can’t deal the same card twice, but the correct calculation is a lot more complicated, and 1/4 is a pretty good estimate anyway. To do my sanity check, while playing I counted how many flops had an ace for a couple of hours of play. I made sure to count hands I was playing and also hands I was not playing as well. I came up with something pretty close to 1/4, so it seems that the number of flops with an ace in them is normal. When I had an ace then the number of flops with an ace in them was lower, but actually that is normal too: If I have an ace in my hand then that ace can no longer show up on the flop, so the odds are lower.

Incidence of pocket pairs and strong hands is a little harder to refute, particularly because at first it sounded true to me. On RPP you see trips, straights, flushes and full houses all the time. Quads aren’t even all that rare, and you even see a straight flush once in a while. At first I thought this accusation was just plain true, but then I thought about it some more:

There are three reasons why it seems like RPP has more strong hands. First, let’s talk about the biggest one, and then I will mention the other two.

The biggest reason why it seems like there are too many good hands is because on RPP it is not uncommon to see a table with over 100 hands per hour. This is because on RPP shuffling and dealing is instantaneous, and counting chips also takes no time. Furthermore you get a very short amount of time to make any decision, and you can pre-check an option so that your call can happen faster than you could even say “check” in real life. This adds up to a much faster rate of play. I watched a real game of poker for a while to compare: Hands took about 8 minutes each, which is just under 8 hands per hour. In other words, RPP is over 12 times faster! As a result, in one hour of play on RPP you will see as many hands as you would in 12 hours of play on a real table. When you put it that way it should be less shocking that you see so many good hands in an hour on RPP: You will see some pretty good hands in real life too if you give it 12 hours!

There are another two factors which also weigh in along with the number of hands: The first is that when you fold you get to see your greyed out cards as the hand plays out. In a normal game, you fold your off suit 3-10 and forget about it, but on RPP when the turn and river are both 3s, you notice it! The other factor is just how many people call on RPP. Over half of the players on this site seem to call every single hand preflop, and I have seen many players get to showdown 10 or more hands in a row (with or without the cards to back it up). This means that if their off suit 5-9 happened to turn into a striaght, you will see it. That wouldn’t happen in real life.

Having these realizations, I did another couple of basic sanity checks. Checking all kinds of good hands at once is very complicated, but it isn’t too hard - for instance - to see how many times I hit a flush draw by the river if I had one on the flop. The sample size here was much smaller, of course, but RPP passed these basic tests too.

In conclusion: I really don’t think RPP is rigged in any way. I have not checked all of the accusations that people have made against the algorithm, but I looked into a few of the saner sounding ones and found no credible reason to doubt that RPP was fair. Yeah, I guess it’s possible that RPP does something to put its thumb on the scale in some particularly weird way, but as I said before, it would actually be easier just to make everything fair.


Maybe Replay has a database of PhD students in statistics, and switches to the non-rigged version when they are detected on the site.

All I know is I once had a full house, and my opponent rivered quads! Quads, I tell you! Explain that, Mr. Smarty Pants!

Nice post, by the way, thanks!

1 Like

Well, something is fishy in Denmark…

[quote=“spivak, post:1, topic:6651”]
The mersenne twister is VERY good.
[/quote]I have never heard this term, so I’ll ask it this way…
X=RND(1) … where X = a random number between 0 and 1 … are you talking about the coding that allows that to work ??

public void Shuffle(Guid guid1, Guid guid2)
    int[] cardsToGet = new int[] { 5, 5, 6, 6, 6, 7, 8, 9 };
    byte[] b1 = guid1.ToByteArray();
    byte[] b2 = guid2.ToByteArray();

    byte[] all = new byte[b1.Length + b2.Length];
    Array.Copy(b1, all, b1.Length);
    Array.Copy(b2, 0, all, b1.Length, b2.Length);

    List<Card> cards = new List<Card>(this);

    for (int c = 0; c < cardsToGet.Length; c++)
        int seed = BitConverter.ToInt32(all, c * 4);
        Random random = new Random(seed);
        for (int d = 0; d < cardsToGet[c]; d++)
            int index = random.Next(cards.Count);


1 Like

Yes. When you write X=RND(1) or X=random.random() or x=runif(1,0,1), or whatever way you want to write that in whatever language you choose. In almost all of these cases, this will be a call to a mersenne twister algorithm under the hood. There are many algorithms for generating pseudorandom numbers (I wrote and tested a couple of them as a homework assignment once) and the mersenne twister is only one of them, but it is a pretty good one. It is very fast, passes all of the most stringent tests that we know of, and has a period which is so big that even if every atom in the universe used it to generate a random number once a second from the big bang until now, it still would not have repeated.

That would work, but I really doubt that RPP is written in C++


Thats all I was ask’n spivak … you see from that 1 statement, all “randomness” is usually generated… how it is used/implemented is a whole other animal. Most programmers also know that when a computer is reset so is its randomness therefore they usually incorporate a way thru user input ( thats usually random ) start the randomness going, so to speak…

Having said that, just the fact that online poker is so fast … makes our brains see patterns, we don’t see otherwise… but there’s only so much that really needs to be randomized once play has begun , if the code is working correctly… due to the fact that how ppl play dictate the dead pile, which then influences the next shuffle/deal … you also have to have some randomness in how cards are shuffled/cut for shuffle, because a Human will never always get a perfect cut and/or shuffle ( ie- 26/26 or every other card perfectly )…

I ran a simulation in highschool, using a perfect cut & perfect shuffle… no kidding after a certain # of shuffles, the cards damn near shuffled themselves back to a clean deck on thier own… so I did learn to add in randomness there, and limit # of shuffles between hands… other than that, how the players discard thier cards is a constant randomizer for the deck… sure a computer is never gonna do the whole table wash… but when I hear ppl say how dare what they had this hand effect next hand, I say… well sure it does… as it should !!

I do see a couple things here that make me go hmmmmmm, but I can’t say Its rigg’d either…

I just like the garbage collector lol

Online, the previous shuffles have no effect at all on the next one.

1 Like

Also, as I understand it (or misunderstand it), they effectively shuffle before each card.

It probably goes something like this…

Generate a random number.
Beat the random number with a big math stick until it corresponds to a specific card.
Check to see if that card has already been dealt, if so, start over.
Record this card as dealt.
Send card to the table.
Go back and do it again until you have dealt the right number of cards.


Not sure what you mean. It is possible to emulate a human shuffle, but that is much more difficult than the obvious way. The usual idea would be to not shuffle at all: just deal at random. For each new card just picking a random number between 0 and 1, multiply by the number of cards which have yet to be dealt, and take the ceiling. This is, for example, what AreYouAhead’s code does. (There are more efficient ways than this, which can get more than one card per random number, but I really doubt RPP does any of that.)

for fun, I wrote a Video Poker Machine program. I used an array for the deck, and I recreated a human shuffler… there was a dead pile, and everything worked fine… It was just like a casino, and paid out… yes it was me vs it, but the thinking on a Hold’em table would be no different…

Its not that difficult, and yes your way is easier and for lazy programmers in my opinion…it also exposes the hidden patterns in all computer generated random numbers, in long data sets… My way once the deck gets going, the players self randomize the cards before it gets shuffled…

1 Like

“it also exposes the hidden patterns in all computer generated random numbers, in long data sets”.

If you can find a hidden pattern in the mersenne twister then you can probably sell that information to the government of a country of your choice for several million dollars. Alternatively you could publish it in a scientific journal and become very famous: Your name would probably be in statistics textbooks for a few generations to come.

There is a large suite of tests for uniform randomness which have been accrued over the years by the statistics community. Every last one of these tests has been tried on the numbers produced by the MT for absurdly long (tens of millions) data sets. The MT has passed every test we know how to throw at it: It is VERY good.

Of note, there are some OLD software packages which do not use the MT and which produced some (relatively) low quality random numbers. The MT blew them out of the water and has replaced them pretty much everywhere. You can be pretty confident thant any software written in the last 15 years now uses the MT and has been purged of bad RNG.

Immitating organic shuffling is only necessary if you don’t trust the MT, but the MT has proven time and again that it is more trustworthy than real shuffling. Doing it the obvious way is not lazy; it’s better: it saves CPU time, it saves human effort, and it produces more uniform randomization.

Full disclosure: There is one known pattern in the MT: It eventually repeats itself. That sounds bad at first, but you should be aware that the period of repetition is so huge that we could build a million computers a second and have them all do nothing except generate as many random numbers as possible for the next billion years, and we still would not have come even remotely close to completing a single cycle. (If you compare this to some older RNG algorithms, those can be cycled out in a few of minutes on a laptop)

1 Like

Are you gonna tell me @least 3 teachers of computer programming all with masters degrees are wrong in what they tell every student every semester ??? if a computer is turned on, and no other code runs other than a RNG, every reset, resets the pattern … and yes the pattern is the same each time…Its a proven fact. it doesn’t matter if it takes 1 zillion numbers before it repeats… the beginning of the pattern is static.

i believe there is definitely a pattern :smiley:

If you use the same seed then you will get the same numbers. This is a simple fact. Just don’t use the same seed each time and the problem is solved.

OK, here’s how they do it… (from a Sept 2015 post by gatzby, in the “Fairness Debate” thread)

“Here’s how the dealer works: For each hand, we create a new deck deck of cards ordered lowest to highest. A card is then randomly selected from that deck and put it into another deck. This process is repeated until every card has been randomly selected from the first deck and moved to the second deck. After the second (entirely random) deck is complete, the dealing process begins from the top of the deck just as you would have in real life poker. As mentioned before, this process has absolutely no knowledge of anybody’s hands or previous decks.”

So yeah, they effectively shuffle before drawing each card as they assemble the “shuffled” deck.

1 Like

Except this NEVER happens in real life. Your operating system is running all kinds of code in the background. For example, just checking for updates or synchronizing your clock introduces significant time variables. My current system is running 4.5 BILLION cycles per second. If I rebooted at the same second every day, it still has over 12.3 million years worth of cycles it could land on.

Your teachers were right in a theoretical sense, but the point is moot.

1 Like


All advanced crop circles.

Emillio Scratch