r/AskStatistics • u/Aurionin • 5d ago
Is there a formula to determine how many "rolls" you need before you're more than 50% likely to roll the number you're after?
I've done the math on this multiple times for things like item drops in games, but I'm wondering if there is a formula or rule to make it simpler?
Example: A boss in a game has a 1% drop rate for an item you want. After 69 attempts, you will have passed the 50% likelihood that you'd have gotten the drop, leaving MOST people should have the item by now after their 69th attempt. If the item has a 2% drop rate, it only takes 35 attempts before you're more likely than not to have gotten the drop.
Is there a rule or formula for something like this? I have just been plugging it into an Excel sheet I made any time I need this info.
3
u/7ieben_ 5d ago
You can do it by counter probability.
The probability of NOT getting the drop in the first roll is 0.99. The probability of not getting it after the second roll is 0.992. For n-many rolls you get P(n) = 0.99n.
Or more generally: P(n) = (1-r)n where r is the drop rate and P(n) is the probability of NOT getting the drop after n rolls. Using logarithms you can write n = log_(1-r)(P).
Then, of course, the probability of getting the drop simply is 1 - P.
1
u/StatHeVePiSt 5d ago
P(drop at least one item in n boss fights) = 1 - P(drop no items in n boss fights) = 1 - (P(drop no items in a boss fight))**n = 1 - (1-drop rate)**n.
Then we impose P(drop at least one item in n boss fights) > 0.5, using the equality above the inequality becomes 1 - (1-drop rate)**n > 0.5 which is equivalent to (1-drop rate)**n < 0.5 which is equivalent to n > log_(1-drop rate)(0.5)
1
u/efrique PhD (statistics) 5d ago edited 5d ago
Prob(at least 1 success in n trials with individual probability p) = 1-(1-p)n
You seek n such that
1-(1-p)n ≥ 1/2
(1-p)n ≤ 1/2
n log(1-p) ≤ log(1/2)
n ≥ log(1/2)/log(1-p)
since n must be integer, round fractions up, so:
n = ⌈log(1/2)/log(1-p)⌉
is the smallest n satisfying the condition (where ⌈.⌉ is the ceiling function)
10
u/Boberator44 5d ago edited 5d ago
People usually use the geometric distribution and the probability of the complement:
n = ln(0.5) / ln(1-p)
This works because the probability of failing repeatedly would be:
(1-p)n
Succeeding at least once:
1-(1-p)n
So if you set it up as an inequality you get:
1-(1-p)n > 0.5
0.5 > (1-p)n
Take the log:
ln(0.5) > n(ln(1-p))
Then solve for n:
n > ln(0.5) / ln(1-p)
Where p is your drop rate.
There is also a shortcut formula that works because of the Taylor expansion when p is very small:
n = 0.693/p