How many rounds happen before the series of n failures?

There is a gap of numbers from 0 to 99.99. Of this period, selects a series of numbers. The program generates each iteration a random number from the first interval. How to calculate how many hits the target number will be (on average), until a series of n failures?
The formula should take a chance on success (that is, if the selected target range 0-20, the chances of success - 20%) in the form of one whole number and the number of misses.
Thank you all in advance)
March 23rd 20 at 19:32
1 answer
March 23rd 20 at 19:34
Solution
You have 10000 values. You choose N values. So the probability to get p0 = N/10000.
Well, then clean the theory goes. You need to find the probability of k hits in a row, followed by n misses in a row. Therefore, p(k,n) = p0^k*(1-p0)^n. Then specify confidence probability p1, say, let the event come when its probability is not less than 0.9. Well, choose k and n to p(k,n)>=p1.

But this theory using numerical methods themselves, print the desired formula in the program.

Find more questions by tags Random numbersProbability theoryMathematics