Skip to content

Instantly share code, notes, and snippets.

@RoboTeddy
Created November 22, 2010 00:43
Show Gist options
  • Save RoboTeddy/709354 to your computer and use it in GitHub Desktop.
Save RoboTeddy/709354 to your computer and use it in GitHub Desktop.
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