Let's say I have a random number generator that generates integers uniformly from 0 to n-1 (where n is some positive integer). What is the expected number of iterations after which all the values 0..n-1 will be generated? I did some simulations and the results seem close to n*ln(n), but I wonder how to solve it mathematically.
Possibly related SO question
Asked
Active
Viewed 559 times
1
1 Answers
2
This is known as the coupon collector's problem. See the link for details and references. You are right that asymptotically, the expected number of trials needed grows as $n \ln n$ (plus lower order terms).
Nate Eldredge
- 101,664
-
Ah, the harmonic series, of course – aditsu quit because SE is EVIL Nov 20 '13 at 16:37