Created
December 4, 2019 14:54
-
-
Save Nydhal/c0bf7bfb9c852b474ac4b500d4db8a10 to your computer and use it in GitHub Desktop.
Python Simulation of the Coupon Collector Problem Expectation a.k.a Mean Cover Time of a Random Walk on a Complete Graph K_n (n=52, 10000 trials).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random as rd | |
for _ in range(10000): seen, n_draws = set(), 0 | |
while len(seen)<52: | |
seen.add(rd.randint(1,52)) | |
n_draws +=1 | |
result.append(n_draws) | |
print (sum(result) / len(result)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment