Tuesday, March 13, 2012

Night School: The Math of Drop Rates

Hopefully that chestpiece is in this pile somewhere...
Drop rates are where most people will encounter and be aware of randomness in World of Warcraft. The other places would be in crits and random procs, of course. There can also be quite a bit of misunderstanding about how they work. Everybody knows the basics, of course: when the boss dies, the game rolls some random numbers and finds those numbers in the loot table to see what the boss should drop. Different items have different drop rates, which come from that item occupying a larger or smaller section of the loot table, making it more or less likely to drop. Other things, like tier tokens and legendary weapon fragments are often rolled for on separate tables from the normal loot.

For the duration of this post, I talk about drop rates with the percents, but all the math with be done with the decimal. So, 10% is 0.10, 5% is 0.05, and 100% is 1. Percents (Latin for "per 100") are a great way to talk about these things, but you cannot do the actual math with them, one must convert them to decimals.

How long until this item will drop?
That's the big question, isn't it. When will my shield drop? Why can't I get a shoulder token? Where is that stupid phoenix mount? Let's just assume that you're the only person contending for a particular item, and that when it drops it will go to you. Will you indulge me by allowing me a table? Who am I kidding? I'm putting a table here whether you like it or not.

Minimum Kills for X% of people?
Drop rate
% of players50%10%1%
50%2769
10%422230
1%744459

An entry from this chart should read as, "With a drop rate of 10%, 50% of players will have to kill the boss 7 or more tries."

So how do you like those numbers? That mount that has a 1% drop rate? There's a ~50% chance it will take you 68 or fewer tries. There's also a 10% chance it will take you 230 or more tries. You might notice that the numbers for 1% of players is roughly double that for the 10% of players. This is because 1% is 10% of 10%. But where does all this come from?

Suppose the probability that an item will drop is p, and the probability that it won't drop would then be 1-p. If you want to know the probability that something will drop after you've killed the boss x times, that's actually difficult to directly calculate, because it could drop multiple times. When calculating probabilities, you'll very often run into situations where the thing you want to know is hard to calculate directly, but the opposite of it (in this case, the probability that the item won't drop in x kills) is very easy to calculate. In that case you calculate the probability that it won't happen and then subtract the result from 1.

In our question, calculating the probability that something won't drop is easy. You simply take the probability that it won't drop from a single kill, 1-p, and raise it to the power of the number of kills, x. You multiply because these are independent events, meaning that the outcome of one event (a kill) does not affect the outcome of the other events. This makes the probability that the item won't drop is*
and the probability that it will drop at least once is
One thing that could be noticed from playing around with that equation is that, for any positive value of x,  unless p=0 or 1, the formula will never equal 0 or 1. In other words, the only times when there is absolute certainty is when the drop isn't random, or you haven't killed the boss yet. Here is a chart that depicts the probability that an item will have dropped based on how many kills have been attempted. Here, the probability of a drop is 10%.

Wolfram Alpha is a great source for doing math.** 
You'll notice that even at the number of kills get's very large, the probability that the item will have dropped never actually hits 1. So no matter how many times you kill, there's no guarantee that the item will drop.

There is an article written by Brian Wood on WoWInsider that contains a wonderful calculator for drop rate percentages such as this. I highly recommend that you check it out here.

Corollary: Average Number of Drops
Of course, the previous section is based on an assumption that you'll only want one of an item, and that it will only drop from one boss/monster. Say you are farming something that has a <100% chance of dropping from whatever you're killing. Let's say it's Relics of Ulduar. It has an 11% percent chance of dropping off of Mildred the Cruel If you want to know the average number that you should expect to get after so many kills, you just multiply the probability of it dropping by the number of kills. If you were to kill Mildred 26 times, then you should expect to have an average of .11*26=2.86 Relics of Ulduar.

The mousover text for those equations contains the LaTeX code used to produce them at the Online LaTeX Equation Editor. Note: "\left(" and "\right)" weren't actually necessary for those, I could have just used "(" and ")" but it's considered a best practice to use the longer ones because they scale in size with their contents. Consider the example below:


**I used Wolfram Alpha to produce the graph up above. It's an amazing thing. Like if Google could do your homework. It can factor polynomials, give population statistics, and even do calculus. I used the free trial of the pro service to get the graph above. The whole thing blows my damn mind.