Last active
August 29, 2015 13:58
-
-
Save Kodiologist/9998032 to your computer and use it in GitHub Desktop.
Estimate waiting times for the Plounge AMA
This file contains hidden or 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
from random import randint, choice | |
waitlist_growths = [2, 2, 3, 4, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 8, 9, 9, 9, 10, 13, 14, 17] | |
# I took the most recent 166 top-level comments to the AMA | |
# signup thread, grouped them by week, and counted the size of | |
# each group. | |
# http://www.reddit.com/r/MyLittleShellbullet17/comments/1pnhpx/ama_sign_up/cgko9z8?context=5 | |
def howlong( | |
initial_waitlist_len = 483, | |
amas_per_week = 4): | |
waitlist_len = initial_waitlist_len | |
weeks_elapsed = 0 | |
while 1: | |
for ama in range(amas_per_week): | |
while 1: | |
if waitlist_len == 0: | |
# You're the only person left, so you must be | |
# picked. | |
return weeks_elapsed | |
if randint(1, waitlist_len + 1) == 1: | |
# You were picked. | |
return weeks_elapsed | |
if randint(0, 1): | |
# Shelly passed over this name. | |
# If it came up again, he'd probably pass over it again. | |
# So, let's remove it from the list. | |
waitlist_len -= 1 | |
break | |
# This person gets an AMA, so they're removed from | |
# the waitlist. | |
waitlist_len -= 1 | |
# The waitlist grows. | |
waitlist_len += choice(waitlist_growths) | |
# A week passes. | |
weeks_elapsed += 1 | |
mean = lambda v: float(sum(v)) / len(v) | |
N = 10000 | |
days = sorted([7 * howlong() for _ in xrange(N)]) | |
print '[{} - {} - {}]'.format( | |
days[int(N*.025)], days[int(N/2)], days[int(N*.975)]) | |
print 'Mean:', int(round(mean(days))) | |
print 'Proportion >=:' | |
for y in (1, 2, 3): | |
print ' ', y, 'year' + ('' if y == 1 else 's') + ':', mean([int(x >= y*365) for x in days]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment