Randomness in Magic

There have been many articles written about shuffling, and yet a lot of people still don’t understand it very well. In this article, I’m going to try a slightly different approach. Instead of just talking about the common shuffling methods and which ones are the best, I’m going to go over exactly what randomness is, how it applies to real-life shuffling, and what the different shuffling methods actually do to the cards in your deck. This article is a bit longer than you might be used to, but I guarantee it’s worth the read. Once we’re done, you’ll be able to explain exactly what randomness means as a concept and why certain ways of shuffling are better than others.

Randomness in Theory

Before we talk about actual shuffling of a deck, let’s talk about randomness itself. Don’t worry- I’m not going to bombard you with a bunch of probabilities and calculations. I just want to go over what it means for something to be “random”.

A common misconception about random chance is that an event can be “due”. If I flip a fair coin 10 times and get heads every time, it is not more likely to come up tails next time. For that to be the more likely outcome, the coin would somehow have to be “remembering” what the past results were, and using that information to determine the next result. This obviously is beyond the capabilities of a coin. This mistaken belief is called the Gambler's Fallacy.

Now let me ask you a question. Which of these two images is a random distribution of dots, and which one has some underlying rule?

Most people say that image B is the random one, but it's actually image A. Image B has the rule that every dot must be at a minimum distance from every other dot. People tend to perceive true randomness as having patterns, and expect randomness to mean the same as "evenly distributed". This is really just a general form of the gambler's fallacy- expecting that the position of one dot can influence the position of another dot in order to make the whole picture "fair". (More specifically, this perception of randomly distributed clumps as having some underlying reason is called the clustering illusion.)

Similarly, let’s say we have a deck containing 30 Plains and 30 Swamps. If the deck is properly randomized, that doesn’t mean that there are no clumps of one type of land. For that to be the case, each card would somehow have to be able to look at the surrounding cards, see that they are the same type as itself, and move itself away from them. In fact, a configuration of no clumps (a regular alternation between Plains and Swamps) is extremely unlikely (about 1.7*10^-17).

This image demonstrates the same concept applied to a deck of Magic cards. Each black space is land, and each white space is a nonland. The top row has no clumps, while the bottom row is more representative of a typical random distribution.

People tend to see patterns in everything, and often perceive those patterns as having some design. It’s important to realize that truly random events will often have runs of a certain result- if they didn’t, they would be predictable, which isn’t random. Check out this article for an analysis of the expected number and size of clumps you should be seeing in a properly randomized deck.

The reason people have this misconception is because random events tend to average out after several iterations. If I flip a coin 10 times, the most likely result is 5 heads and 5 tails. The next most likely result is 4 of one and 6 of the other. Etc. The reason this occurs is that there are more ways to get a result of 5 and 5 than of 10 and 0. There is only one way to get 10 heads- every flip has to come up heads. To get 5 heads and 5 tails though, there are many more ways to do it. The first 5 could be heads and the last 5 could be tails. It could alternate- “heads, tails, heads, tails, heads, tails, etc”. Or (most likely) it will look pretty arbitrary, such as “heads, heads, tails, heads, tails, tails, tails, heads, tails, heads”. It’s the difference in the number of ways to achieve the result that causes this averaging out. This tendency for results to average out in the long run is known as the law of large numbers.

Randomness in Real Life

In the real world, there’s no such thing as “truly random” (putting aside quantum mechanics). So we have to resort to pseudorandom generators, ones that are “random enough”. When you flip a coin, it’s not a perfect 50/50 chance. Air currents, imperfections in the coin, and the exact way you flipped it, among other things, all combine to make the result seemingly random. In truth, flipping the coin is a completely deterministic process. In fact, it’s possible to flip a coin and have it land the way you want it to (with enough practice).

When your computer needs a random number, it will take some input number (called a “seed”), and perform some math to return a number within the range you wanted. Common methods to get the seed are to look at the current time in small fractions of a second, listen to atmospheric noise, measure the time between keystrokes, or measure internal voltage differences in the computer. If you could control all the inputs exactly, you would know what number it will spit out.

When it comes to shuffling decks of cards, we do things a little differently. We could design a computer program to generate pseudorandom numbers, attach the computer to a robot arm, and have it shuffle our deck for us. Happily, we humans have our own pseudorandom number generators built in! When we move our hands to shuffle, we don’t choose exactly where to put the cards, we just let our hands do that for us. And since we don’t see or remember where each card went, we can sufficiently randomize our decks that way.

In real life, there’s also a concept of the reverse of the Gambler’s Fallacy; namely that if a coin comes up heads 20 times in a row, then the next flip is more likely to be heads. And this is actually true! The thing to recognise here is that in the real world we have to take into account the possibility of the random number generator not being so random. If I flip a coin repeatedly and it keeps coming up heads over and over, eventually I’m going to realize that the coin isn’t actually a fair coin. At some point, it’s much more likely that I have been given a weighted coin than that it just happened to land on heads so many times. (Of course this effect is very small- it would take something like 20 heads in a row before one should start thinking the coin is biased, unless you were given it by an exceptionally untrustworthy friend.)

The same principle applies to Magic. If you look at your deck and see that the lands are perfectly spread out with no clumps, there is a chance it just happened to get shuffled that way. However, that chance is extremely small, and the chance that you shuffled badly (or are cheating) is much larger.

Decks of Cards

Now when it comes to decks of cards, the first thing to recognize is that probability is about information. The top card isn’t going to change, it’s already a Plains or a Swamp. However, I don’t know what it is until I look at it, which is why I have to resort to probability. If I have a randomized deck of 30 Plains and 30 Swamps, the chance that the top card is a Plains is 30 out of 60, or 50%. If I look at the top card and it’s a Plains, I have gained more information about the deck- I now know that the chance of the top card being a Plains is 100%, and the chance of the next card down being a Plains is just 29 out of 59. Seeing the top card of the library didn’t change the second card down, it simply gave me more information about what that card is. This is different from the Gambler’s Fallacy, because the deck is changing as I draw cards. If after I looked at the Plains on top I then shuffled it back in to the deck, I wouldn’t have gained any information about the top card at all- it’s not any more likely to now be a Swamp.

Different people can have different amounts of information about an event, and therefore calculate different probabilities for it. Say that my opponent fateseals me and sees that the top card of my library is Lightning Bolt. Afterwards, I play a spell which has me look at the top two cards of my library and put them on the bottom in a random order. What's the chance my opponent calculates that the bottom card is a Lightning Bolt? Well, the chance that that specific Lightning Bolt is on the bottom of my library is 1/2. But my deck is probably playing more than one. Let's say that my current library contains 50 cards and both players know that I play 4 Lightning Bolts. Additionally, I have no cards in hand, so both I and my opponent know that all Lightning Bolts are still in the library. What's the chance now? My opponent knows for sure that one of the two bottom cards is a Lightning Bolt. The other card has a 3/49 chance of being a Lightning Bolt. So putting those together, the chance of the bottom card being a Lightning Bolt is 1 - (1/2 * 46/49), or about 53%. (In order for the bottom card to not be Lightning Bolt, it needs to be the case that it isn't the known Lightning Bolt (probability 1/2) and the other card needs to not be a Lightning Bolt (probability 46/49), so the chance of both of those being true is simply their product.) I on the other hand saw both cards and know that the other one wasn't a Lightning Bolt, so I calculate the chance of the bottom card being Lightning Bolt as exactly 50%. Both me and my opponent are acting on the best information available to us, but because that information is different, we get different results. (You may notice that I have more information than my opponent in this scenario, so my probability is "better" in some sense. This is Bayesian statistics, and a good introduction to it is here.)

Future information is also a consideration. For example, let’s say you know that your 4 Lightning Bolts are all next to one another in the deck. After cutting the deck at a random position, the chance that the top card of your library is a Lighting Bolt isn’t affected by that knowledge- you won’t be able to predict your draw with any more accuracy than normal. However as soon as you draw a Lightning Bolt, you now have a 75% chance of your next draw being a Lightning Bolt too. In other words, information about a card’s position relative to other cards still decreases the overall randomization of the deck.

Information that you could figure out from clues in the deck is also a problem. Let’s say someone gives you a deck with 30 Plains on top and 30 Swamps on the bottom, but they tell you it’s randomized. Well for your first draws, you don’t know that they lied, so the probability you calculate of drawing a Plains is 50%. After a while though, you notice a pattern, and you figure out that your friend wasn’t telling the truth. In other words, the chance of having that many Plains on top of your library was lower than the chance that your friend lied. You are now able to accurately predict that the next several cards are Plains, so your deck is not sufficiently randomised. (This is another example of the reverse of the Gambler’s Fallacy mentioned above.)

Let’s say you have a deck of 20 land and 40 nonland cards. Your opening hand is one land and 6 nonlands. When you are deciding whether to keep that hand, the only information that matters is the information you actually have. Yes, if you knew that the card on top of your library was a land, then keeping the hand is the correct decision. But the actual chance of the top card being a land is just 19 out of 53, or about 36%. If you make the logical decision to mulligan, then you look at the top card and see a land, that doesn’t make your decision wrong. The top card of your library wasn’t information that you had access to at the time. For all intents and purposes, that top card wasn’t a land while you were deciding- it was an unknown card that had a 36% chance of being a land, and that’s what matters.

To address another common misconception, being milled does not make you less likely to draw good cards. Let’s say you have 50 cards left in your library and only one of them is the Lightning Bolt that you need in order to win the game. Well the chance of drawing on your next turn it is 1 out of 50. But now your opponent mills the top card of your library into your graveyard, and lo and behold- it’s the Lightning Bolt. Well that sucks, since you now know that the chance of drawing the Lightning Bolt is 0 out of 49, or simply 0. But it’s the fact that it was the Lightning Bolt milled that is bad. If your opponent had milled a Mountain, then your chance of drawing that Bolt would have gone up, to 1 out of 48. (If there's one card in your library that you want and you’re being milled one card, there’s a 1 in 50 chance of it being very bad for you, while there’s a 49 in 50 chance that it’s slightly good for you by bringing you closer to the card you need.) Removing cards from the library doesn’t change the probability of the remaining cards, until you see them. Once you know what cards have been removed, you have more information about the remaining cards in your library. (This is the difference between drawing "with replacement" and drawing "without replacement". If you reshuffle every card you draw, the chances of the next card you're drawing don't change. In normal Magic however the cards you draw don't go back into the library, so each card you draw slightly changes the remaining probabilities. For a wonderfully-written example of how this concept applies to deckbuilding, see here.)

This brings me to my last misconception, which is that simply shuffling your library or moving unknown cards from the top to the bottom somehow makes you more or less likely to draw the card you want. If you shuffled properly, every card in the deck has an equal chance of being on top. Moving cards around without seeing them doesn’t give you any information, so it doesn’t change anything.

Shuffling strategies

One thing you may have heard is that the amount you need to shuffle is based on how organised your deck was beforehand. A more accurate phrasing of that claim is that the amount you need to shuffle is based on how much information you had about your deck beforehand. For example, the claim is that if you start with a deck that you know everything about, say 30 Plains on top and 30 Swamps on bottom, you will need to shuffle that deck a lot before we can consider it “sufficiently randomized”. Whereas if you already had a randomized deck and you just looked at the top card, you would need to shuffle less before you’d “forget” everything you knew about the deck. While this is true, it takes more than one or two riffle shuffles to make you forget the information you have gained. If you just look through your library and grab a land from the top, you still need to shuffle thoroughly enough that you can’t remember where any of the cards you saw went. (For example, if I know a Lightning Bolt was on top of my library when I started shuffling, after two riffle shuffles I know that it’s still within a few cards of the top. The top card doesn’t move very much (if at all) in a single riffle.)

Not shuffling enough in real life is the main reason that people complain about the MTGO shuffler. (Writing code to put a list into a random order is trivial in any modern programming language. For any serious program to still manage to screw that up would require unbelievably poor programming. WOTC stepped up to the challenge however, and it turns out that the MTGO shuffler actually is biased when it comes to the "sample hand" functionality. For all in-game shuffles, it works properly, giving a truly random distribution.) With physical cards, there are subtle patterns that occur when people don’t shuffle enough in between games. They aren’t always easily visible at a glance, but people get used to them over hundreds of games. When presented with a properly random shuffle online, the person perceives the difference as the online shuffler being “rigged” when it’s actually their normal shuffling that’s bad. The other reason for the complaints is that as mentioned above, unlikely things are still possible. When you have literally billions of shuffles being executed, it's well expected that some players are going to have highly unlikely things happen to them. People are more likely to remember these exceptional experiences and minimize the much the larger number of normal experiences, leading to the perception of unfairness. (Note that Arena actually does use a non-random shuffling algorithm for best-of-one games, in order to minimize mana screw/mana flood in your opening hand. Opening hands in a properly shuffled deck in paper will actually be worse on average than opening hands in Arena BO1. Specifically, each time it shuffles the deck it's completely random, but when drawing an opening hand it actually draws 2 random hands internally and gives you the one that has the proportion of lands in the hand closest to the proportion of lands in the deck. Arena Hand Smoothing)

Mana weaving: Mana weaving isn’t shuffling. It’s stacking your deck to be in a specific order that you want, no different than putting your perfect 7-card hand on top. If you shuffle thoroughly afterwards, then it’s perfectly ok to mana weave. A thorough shuffle means your ending deck configuration is unrelated to how it started out. In which case- Why did you mana weave in the first place?

To provide an analogy- you’re about to drive in a car race. You put illegal superpowered fuel into your car, then you take it out again before the race starts. Either you left some of it in, in which case you are cheating, or you removed it all, in which case- what was the point? Either way, people are likely to be suspicious of your actions.

Pile shuffling: There are 2 ways to pile shuffle. One is to have some number of piles, and put cards from your deck into the piles in order. Then pick them up and repeat. This is not shuffling. No matter how many times you do this, the cards are still going to be in some predictable pattern. It was actually a pretty good way to cheat before people caught on. (Here is another, simpler example of how deterministic pile "shuffling" allows deck stacking.)

Notably, the number of piles you use won’t make the deck any more random. It just changes what patterns it goes through.

The other way to pile shuffle is to have some piles in front of you and randomly pick which pile to put the next card on. This does achieve some measure of randomisation. However, you must be cautious when doing this, as there is much more conscious thought involved with this method than there is when using another method of shuffling. This makes it very easy for patterns to emerge. For example, if I pile shuffle into five piles, randomly picking which pile I put each card in, I still know that the card that was on the bottom of my deck in the last "shuffle" is going to be in one of five positions in the next.

Shuffling this way is not very effective, because each pile shuffle takes many times as long as a riffle shuffle while acomplishing about the same amount.

If you want to count your deck into piles in order to make sure you have the correct number of cards and/or that your sleeves aren't stuck together, that’s ok. However there are much faster ways of counting your deck, and you should never need to do it more than once. (This is the reason for the recent change to the Magic Tournament Rules, which only allows you to pile “shuffle” once per game.) And if your sleeves are sticking together, seperating them is only a temporary fix, as they'll just get stuck again. You should buy new sleeves instead.

Riffle shuffle/mash shuffle: Riffle/mash shuffling is usually thought of as the best way to shuffle, and guess what- it is! Dividing your deck into 2 halves and interweaving those cards is a very effective way to achieve randomization. However there are a few pitfalls:

A single riffle/mash shuffle won’t move the cards near the top and bottom of the deck very much. If a player always takes the top half of the deck with their right hand, and then shuffles so that the cards in their right hand are slightly higher than their left, the top card will never change. The easiest way to avoid this is to just do the opposite- Always be sure that the top half of the deck is shuffled in lower. In other words, make sure that the previous top and bottom cards didn’t stay where they were. This way you will cycle through the whole deck when shuffling, ensuring equal probability of the top card going anywhere. Another option is to cut your deck in between every few shuffles.

You may have heard that 7 riffle shuffles is enough to make the deck random. (In fact this misconception is so prevalent that nearly all the videos I could find on mash shuffling included a mention of it.) Unfortunately, this is not quite accurate. This “7-shuffle rule” comes from a number of different misconceptions and misunderstandings:

The most relevant difference however, is that the numbers in the papers were calculated using something called the Gilbert–Shannon–Reeds model of riffle shuffling. This models a "typical" riffle shuffle so that it can be analysed mathematically. However the myriad ways in which magic players shuffle don’t always conform to that model. Especially when mash shuffling is done instead of riffle shuffling, each shuffle tends to randomise the deck significantly less than the model predicts. (Mash shuffling often leaves sections of the deck at each end unmixed.) While 7 shuffles might be good enough (depending on exactly how you shuffle), it's better to use 10-15 instead. If you shuffle at a normal speed, this shouldn’t take you more than 30 seconds or so, so there's really no reason to cut it close to the line.

Note: Riffle shuffling with the cards facing upwards is pointless, and in fact undoes any prior shuffling, since you are regaining information at the same time as you are losing it. If you want to do it to unbend the cards that’s allowed, but you have to shuffle properly afterwards.

Clump shuffle/Overhand shuffle/Block shuffle/Hindu shuffle: There are a variety of similar shuffles that fall under these names, but they all consist of dividing your deck into a few piles, then putting those piles on top of each other. Within each section of the deck, the order of the cards stays the same. While this method will eventually randomise your deck, it would take several thousand shuffles of this type before your deck even approaches a random distribution.

A few other things:

How long is too long to shuffle? There is no set time limit, and what counts as “reasonable” depends on the circumstances. For normal shuffling of a 60-card deck, 45 seconds should be sufficient as long as you are shuffling quickly and efficiently. Taking longer than that is ok if you have trouble with the hand motions of shuffling or your deck is larger than 60 cards. Taking longer than that because you want to be obstinate and use an inefficient shuffling method is not ok.

Should you use multiple methods of shuffling? You can, but in therory you shouldn't need to. A proper riffle/mash shuffle is the fastest and most efficient shuffle. Interspersing them with a cut or overhand shuffle can help avoid cards getting stuck on the top or bottom of the deck, but if you're riffling/mashing properly this won't be an issue in the first place. Pile shuffling in combination with a riffle/mash shuffle is pointless, you may as well just skip the pile portion.

Unlikely things are still possible. If you mulligan down to one card because you never saw a single land, that doesn’t necessarily mean you shuffled badly. When you play hundreds or thousands of games, you’re bound to see some unlikely occurrences. If it happens often though, that’s a sign that you need to improve your shuffling. (In fact, unless you were mana weaving or pile shuffling in a way that simulates mana weaving, shuffling your deck properly will actually increase your chances of getting a good hand. If you have 23 lands in your 60 card deck, the chance of drawing an opening hand with 2 to 4 lands, allowing one mulligan, is about 94%. If your shuffling method wasn’t good enough, then there are going to be more clumps of lands and nonlands left over from the previous game, and you are more likely to get mana-screwed. Check out this handy tool for calculating the probability of drawing a specific card in your opening hand.)

Insufficient Shuffling is one of the most committed yet least issued infractions. Bad shuffling hurts you. It makes it more likely that your deck contains long runs of lands and nonlands, and lets the cheaters get away with things more easily. If you're a player, plesae try to avoid the pitfalls mentioned in this article. (By far the most common problem is people mash shuffling without changing the top few cards of the deck.) And if you're a judge, please try to get into the habit of watching how people shuffle and nudging them if they need to improve.

Further reading. There are a lot of articles and videos about shuffling out there. Unfortunately, many of the people who write those articles don’t have a good understanding of the topic themselves, and will unintentionally provide incorrect information. (A hilarious example of this is this video. In addition to claiming that pile shuffles are helpful and should be performed several times, he also claims that you should use a number of piles that's a "Mersenne prime". Mersenne primes are any prime numbers that are 1 less than a power of 2, and have nothing to do with shuffling, randomness, or the patterns that arise when you pile shuffle. And just in case you thought it couldn't get any worse, he lists "5" as an example of a Mersenne prime, which... it's not. 6 is not a power of 2.) I’ve provided links to some useful resources throughout this article, and I've done my best to make sure they contain accurate information.

Some practice questions for you:

Question #1

You activate a fetch land and look at the top card of your library. It turns out that it's the land you want to find. Is it ok to just put that on the battlefield and not look through or shuffle the rest of the library?

Yup, this is perfectly fine. (As long as the library was completely random to begin with.) The way to see this is by looking at the definition of randomness:

"The position of any one card carries no information about the position of any other card."

The fact that the top card was the card they were looking for therefore can't tell them anything about the rest of the library. All the other cards are still hidden and no information about them was gained (except that they no longer contain the land that was removed, which is information that would have been gained regardless), so they're already random and there would be no point to shuffling them further.

Question #2

You roll a die and it bumps against your deckbox. Your opponent asks you to reroll it. Should you?

No. A die bouncing off of something introduces more unpredictability into the result, not less. If you were trying to cheat, you'd be rolling the die in a way that gets it to roll and bounce around as little as possible.

More importantly, rerolling could give your opponent a significant advantage. If every time your opponent rolls higher than you they have you reroll the die, they now have a 75% shot at winning rather than the 50% they should. This is a very easy cheat to pull off if they understand randomness and you don't. Any time you give someone a choice about whether to accept a random result or redo it, you give them the ability to make the choice that gets a more favorable outcome for them, and the overall process is no longer fair.