Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm writing a software, where I need an event to occur on average 10 times per 24 hours.

I want to implement that by checking a random number against preset probability every second.

I've tried $10^{1/(3600\cdot 24)}-1$ as that probability, but that is incorrect. I also can calculate that probability using simulation, but that seems lame (as there may be delays in execution, and I want to be able to seamlessly adjust the interval and always get the correct result).

Can anybody help me with the formula and the rationale behind it?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

There are $24\cdot3600=86400$ checks in $24$ hours; if you want the expected number of occurrences to be $10$ the probability needs to be $10/86400=1/8640$. By linearity of expectation the expected number of occurrences is $86400$ times the expected number of occurrences in one check, which is just $1\cdot p+0\cdot(1-p)=p$, the probability itself.

share|improve this answer
    
) oh my. and there I was trying to find a complicated way to solve this! thanks a lot! –  Arsen Zahray Dec 6 '12 at 14:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.