Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've once got 000000. If you do the math it takes about 1 year to cycle through all million of them, assuming no duplicates.

Which makes me wonder, what's the expected repeated distribution?



This is the birthday paradox. The rough approximation is you need sqrt(n) values to get to a 50% chance of having a duplicate. Sqrt of a million is a thousand, and if they're every 30 seconds, that's ~8 hours or so. So you probably get a duplicate or 2 every day.

There's _much_ better approximations than the sqrt one, but I don't know them and the actual math is too hard.


Correct, the article actually mentions the birthday problem somewhere. Even with 10k codes (2 days) you get dozens of duplicates, so I'd say it's potentially even more common.

Sextuples are 1 in 100,000, so something like every 50 days (per account).


> Even with 10k codes (2 days) you get dozens of duplicates, so I'd say it's potentially even more common.

Yeah I screwed up here, at the end:

> Sqrt of a million is a thousand, and if they're every 30 seconds, that's ~8 hours or so. So you probably get a duplicate or 2 every day.

You'd get 1 or 2 every day (approx.) if you're only, at any point, looking at the collection of codes generated in the past 8 hours. But of course that wasn't the question, and the odds go way up once the period we're looking at goes larger and larger over time.

I shouldn't have tried to go beyond "ballpark if you wait 8 hours you have a coinflip of having at least one duplicate", anything more than that requires different math.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: