Hacker News new | ask | show | jobs
by jgtrosh 2891 days ago
Off the top of my head, for a randomly chosen range of size n, you reject a throw with probability 1/4, right?
1 comments

It's unintuitive, but I believe the probability ends up being 1-ln(2) if you think of n as being uniformly random.
For any power of two m, then for any range size n (with m/2 < n <= m), the probability of rejection is (m-n)/m. If any n is equally probable, then the average rejection is equal to the rejection of the average n (= 3*m/4): (m/4)/m = 1/4. This is true for any power of two m. I stand my case!
Hm, yeah not sure what I was thinking. Maybe expected number of attempts?
n uniformly random from what distribution? Or are you taking a limit somewhere?