{"id":19302,"date":"2025-09-05T15:11:52","date_gmt":"2025-09-05T15:11:52","guid":{"rendered":"https:\/\/naijaglobalnews.org\/?p=19302"},"modified":"2025-09-05T15:11:52","modified_gmt":"2025-09-05T15:11:52","slug":"how-the-math-of-shuffling-cards-almost-brought-down-an-online-poker-empire","status":"publish","type":"post","link":"https:\/\/naijaglobalnews.org\/?p=19302","title":{"rendered":"How the Math of Shuffling Cards Almost Brought Down an Online Poker Empire"},"content":{"rendered":"<p>\n<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">If you\u2019ve ever shuffled a deck of playing cards, you\u2019ve most likely created a unique deck. That is, you\u2019re probably the only person who has ever arranged the cards in precisely that order. Although this claim sounds incredible, it\u2019s a great illustration of how quickly large numbers can creep into everyday situations\u2014with occasionally challenging consequences, as the developers of an online poker game painfully discovered in the late 1990s.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">The mathematics of card shuffling is quite easy to explain. To calculate how many arrangements 52 playing cards can have, you must go through all the possible shuffles. So logically, one of the 52 cards is placed on top, and once that\u2019s determined, there are only 51 possibilities for the card below it. The next card has only 50 possible options, and so on. A 52-card deck can therefore be arranged in 52 \u00d7 51 \u00d7 50 \u00d7 &#8230; \u00d7 2 \u00d7 1 = 52! different ways.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">If you do the multiplication and round the answer, you will get a number with 67 zeros. That\u2019s more than a quadrillion times as many ways to arrange these cards as there are atoms on Earth.<\/p>\n<h2>On supporting science journalism<\/h2>\n<p>If you&#8217;re enjoying this article, consider supporting our award-winning journalism by subscribing. By purchasing a subscription you are helping to ensure the future of impactful stories about the discoveries and ideas shaping our world today.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">So clearly there are many, many different ways to arrange 52 playing cards. And yet to find out how likely it is that another person in the world will randomly create the same sequence of cards by shuffling, it\u2019s not enough to simply calculate 1 \/ 52! That number simply indicates how likely it is to get one very specific shuffle of cards.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">There\u2019s a more subtle question to consider: How likely would it be for any two or more people in the world to randomly shuffle a deck of cards in the same way?<\/p>\n<h2 id=\"the-extraordinary-rarity-of-each-and-every-shuffle\" class=\"\" data-block=\"sciam\/heading\">The Extraordinary Rarity of Each and Every Shuffle<\/h2>\n<p class=\"\" data-block=\"sciam\/paragraph\">This question is reminiscent of the birthday paradox. It works according to the same principle: It is rather unlikely that a student in a class has a birthday on a given date\u2014in a group of 30 people, the probability of this is 1 \u2212 (364 \/ 365)30\u2248 7.9 percent. The probability that two students are born on the same day is more than 70 percent, however. The reason for this apparent discrepancy is that people usually underestimate how many possible pairs of students there are. From 30 students, 435 pairs can be formed. The probability that each pair of students was born on a different day then doesn\u2019t seem so high.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">If you want to find out how likely it is to randomly shuffle a deck of cards in the same way as any other person in the world, there are several ways to do it. One is to first calculate the probability of the opposite event and then subtract this result from 1. This means that you first examine how likely it is that all people in the world create a completely new arrangement when mixing: the first person has a probability of 1, the second a probability of (52! \u2013 1) \/ 52!, the third of (52! \u2013 2) \/ 52!, and so on. Then subtract this result from 1.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">If there are eight billion people in the world, the probability that several people create the same shuffle of cards can be calculated as follows:<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">The trouble is that my calculator (or rather, the online program Wolfram|Alpha) fails when I try to evaluate this formula. Therefore, I have to rely on a very rough estimate of this probability:<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">This means that the probability that two or more people in the world will create the same deck of cards is less than 0.0000&#8230;08 percent\u2014a number that only deviates from 0 in the 47th decimal place.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">With that illustration, I hope I have convinced everyone that it is extremely unlikely that several people in the world would randomly create the same deck of cards by shuffling. But you have probably shuffled cards many times in your life, not just once. So how does the result change if we assume that each person shuffles approximately 100 decks of cards in their lifetime? By replacing the eight billion in the previous estimate with 800 billion, we find that the probability in this case is less than 8 \u00d7 10\u221243 percent.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">In other words, the odds don\u2019t change by much. Even if each person in the world shuffles a deck of cards 100 times, it is very unlikely that the same deck will appear twice.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">For that matter, if we consider every person who lives or has ever lived on earth\u2014by some estimates, about 117 billion people\u2014each of whom has shuffled a deck of cards about 100 times (which is unlikely, given that our species has not had playing cards for very long), then the probability that the same arrangement was created multiple times is less than 1.7 \u00d7 10\u221240 percent.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">This makes it clear: it is truly extremely unlikely that two people in the entire history of humanity have ever shuffled a deck of cards the same way\u2014at least assuming they shuffled the cards with great care. This illustrates how big 52! is and how enormously many possibilities there are for arranging 52 cards.<\/p>\n<h2 id=\"read-em-and-weep\" class=\"\" data-block=\"sciam\/heading\">Read \u2019Em and Weep<\/h2>\n<p class=\"\" data-block=\"sciam\/paragraph\">The vastness of 52! is not only inspiring to contemplate\u2014it has also posed some significant practical problems for online game developers. Online poker can involve large sums of money, so it\u2019s critical that these games are as secure and fair as possible. Any flaws or loopholes could be exploited by cheaters or used by the house against players.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">Digital cards should be well shuffled and dealt randomly, just like real ones. In an ideal world, an algorithm would randomly select an arrangement from the 52! possible decks. But no computer has enough memory to evaluate all of these possibilities, and a perfect random number generator doesn\u2019t yet exist. Therefore, developers generally rely on algorithms that simulate card shuffling.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">In the late 1990s the development platform ASF Software supplied several online poker providers, such as Planet Poker, with card-shuffling algorithms. The platform even posted the algorithm on its website as proof that the game was reliably programmed. And this post caught the attention of some employees at Reliable Software Technologies, an IT company. \u201cAs soon as we saw the shuffling algorithm, we began to suspect there might be a problem. A little investigation proved that this intuition was correct,\u201d a few employees wrote in a poston a software development website.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">The algorithm started with an ordered deck of cards and then swapped two cards at a time in several steps. To do this, the program used a random number generator linked to the computer\u2019s system time. But there are several constraints on this method. For one, the swapping mechanism was implemented such that certain card arrangements were favored and more likely to appear than others. For another, the system ties its number generation to the number of seconds that have passed since midnight, resetting once each day, which further limits the possible random values. Only about 86 million arrangements could be generated this way, the Reliable Software Technologies team discovered.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">The programmers then realized that because the system is tied to a clock to randomize its shuffles, the arrangement of cards could be further constrained by taking that timekeeper into account. Simply syncing up their own program to the system clock reduced the possibilities to a mere 200,000 potential decks that the algorithm could generate. \u201cAfter that move, the system is ours, since searching through this tiny set of shuffles is trivial and can be done on a PC in real time,\u201d they wrote. Recall that this was back in the 1990s, when computers were significantly less powerful than they are today.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">The employees of Reliable Software Technologies reported these weaknesses to the algorithm\u2019s developers, who immediately revised it. Today many online poker sites use the Fisher\u2013Yates algorithm, also called the Knuth shuffle (which sounds delightfully like a dance). It\u2019s easy to implement and delivers satisfactory results.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">Of course, these algorithms are constrained in other ways\u2014random generators simply aren\u2019t good enough to do what people can do with an actual deck. But even the most skillful human dealer cannot provide a perfect hand every time.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">Thanks to the German language podcast Nerds at Work podcast for inspiring me to write about this 1990s poker algorithm.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">This article originally appeared in Spektrum der Wissenschaft and was reproduced with permission.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you\u2019ve ever shuffled a deck of playing cards, you\u2019ve most likely created a unique deck. That is, you\u2019re probably the only person who has ever arranged the cards in precisely that order. Although this claim sounds incredible, it\u2019s a great illustration of how quickly large numbers can creep into everyday situations\u2014with occasionally challenging consequences,<\/p>\n","protected":false},"author":1,"featured_media":19303,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[50],"tags":[6456,7637,6893,4693,1186,11820,11819],"class_list":{"0":"post-19302","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-environment","8":"tag-brought","9":"tag-cards","10":"tag-empire","11":"tag-math","12":"tag-online","13":"tag-poker","14":"tag-shuffling"},"_links":{"self":[{"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=\/wp\/v2\/posts\/19302","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19302"}],"version-history":[{"count":0,"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=\/wp\/v2\/posts\/19302\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=\/wp\/v2\/media\/19303"}],"wp:attachment":[{"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}