Created
November 22, 2010 00:43
-
-
Save RoboTeddy/709354 to your computer and use it in GitHub Desktop.
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 | |
n = 100 | |
sets = [set([person_id]) for person_id in range(0, n)] | |
person_id_indicated_by_light = None | |
for day in range(0, 1000000): | |
set = sets[random.randint(0, n-1)] | |
if person_id_indicated_by_light is not None: | |
set.add(person_id_indicated_by_light) | |
if len(set) == 100: | |
print "Freedom in", day/365, "years" | |
break | |
person_id_indicated_by_light = day % 100 if (day % 100 in set) else None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment