Drop Chance Calculator

What is this calculator for

Assume you are playing a game in which there’s a loot box you can open and there’s an item in the loot box that has a drop chance of 0.2%. How many times will you have to open the loot box to guarantee a 95% chance of getting the item?

This calculate calculates exactly this!

How does this calculator work

You give the calculator two out of three inputs. It’ll then calculate the third input automatically.

How to actually calcualte drop chance

I’ll assume a basic knowledge in Algebra and a basic knowledge in Probability.

More precisely, we’ll be using Logarithms and the Binomial Distribution to tackle this problem. You can read up on those two, or just trust the process.

We’ll begin by denoting a few variables.

Let p(0,1)p \in \left(0, 1\right) be the probability of getting the item from each action.
Let c(0,1)c \in \left(0, 1\right) be the success rate we are interested in.
Let nNn \in \mathbb N be the number of times we need to do the experiment.

One last assumption, we’ll assume that the actions are independent. That is, we’ll assume that each action doesn’t affect any other action.

With the last assumption we made, we can use XX to denote a random variable for the number of times we have to do the action (open a loot box for example). We can then infer that:

XBin(n,p) X \sim \mathrm{Bin} \left(n, p\right)

Meaning XX follows a binomial distribution with parameters nn and pp. We want the probability of getting ther items to be greater than cc. Thus, we want the following to be true:

Pr(X1)c \Pr \left(X \ge 1\right) \ge c

However, this isn’t an easy calculation to do optimally. We can still do it, and it wouldn’t take much time, but we would always like a closed solution. We can use the fact that Pr(A)=1Pr(Ac)\Pr\left(A\right) = 1 - \Pr\left(A^c\right) where AcA^c is the complement of the event AA. Using the complement we’ll get that what we are really interested in is:

Pr(X1)c    1Pr(X<1)c \Pr\left(X \ge 1\right) \ge c \iff 1 - \Pr\left(X < 1\right) \ge c

And note that XX counts the number of times we do an action, and as we cannot do an acion a negative number of times, we know that X0X \ge 0 meaning that the expression above is the same as

1Pr(X=0)c 1 - \Pr\left(X = 0\right) \ge c

Doing a bit of algebra we get

Pr(X=0)1c \Pr\left(X = 0\right) \le 1 - c

Since we know XX‘s distribution we can apply the formula to calculate it’s probability and get the following:

(n0)p0(1p)n01c(1p)n1c \binom{n}{0} p^0 \left(1 - p\right)^{n - 0} \le 1 - c \\ \left(1 - p\right)^n \le 1 - c

And now we can apply the logarithm base 1p1 - p to get the value of nn. Note that 1p11 - p \le 1, therefore, we must swap the in-equality symbol.

nlog1p(1c) n \ge \log_{1-p}\left(1 - c\right)

Finally, since nn has to be a whole number, we will round the result upwards to get that the minimum number of times we need to do the action, to get a cc success rate, is

n=log1p(1c) n = \left\lceil \log_{1 - p} \left(1 - c\right) \right\rceil

And that completes our calculator \blacksquare.