Coupon Collector's Problem

Take 2


In [33]:
import numpy as np
from scipy.stats import describe

In [35]:
for n in [10, 100, 1000]:
    avg_ndraws = []
    for itrial in range(100):
        a = np.random.randint(n, size=10*n)
        ndraws = 0
        for i in range(len(a)):
            nuniq = len(set(a[:i+1]))
            if nuniq == n:
                ndraws = i
                avg_ndraws.append(ndraws)
                break
            
    print describe(avg_ndraws)


(100, (12, 78), 26.969999999999999, 164.67585858585858, 2.0782659919118864, 5.115881115930838)
(98, (314, 982), 504.03061224489795, 13050.834104775931, 1.2226255698622155, 2.5876016277736413)
(94, (4649, 9884), 7415.6170212765956, 1251066.2603523219, 0.17674330918941675, -0.4624404853584423)

In [ ]: