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.
- Drop chance - the chance for the item drop (self explanatory).
- Success rate - the percentage of success you want to have of getting the item.
- Action count - how many times you need to repeat the action to achieve said success rate.
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 be the probability of getting the item from each action.
Let be the success rate we are interested in.
Let 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 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:
Meaning follows a binomial distribution with parameters and . We want the probability of getting ther items to be greater than . Thus, we want the following to be true:
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 where is the complement of the event . Using the complement we’ll get that what we are really interested in is:
And note that counts the number of times we do an action, and as we cannot do an acion a negative number of times, we know that meaning that the expression above is the same as
Doing a bit of algebra we get
Since we know ‘s distribution we can apply the formula to calculate it’s probability and get the following:
And now we can apply the logarithm base to get the value of . Note that , therefore, we must swap the in-equality symbol.
Finally, since 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 success rate, is
And that completes our calculator .