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

> Remember that in a group of 30 people, there's a 50% chance 2 of them have the same birthday. Not exactly intuitive.

It's closer to 70%. You're very much correct, with my example, the chance of a collision is very, very high. I recalculated the odds, and by increasing the ID length to 12 (still a manageable size from a human readable standpoint), the odds of hitting a collision from 1M ids drops down to 0.1%.

You can also just use sequences like someone mentioned earlier or seed your hash with something checked for uniqueness in advance, like a username. There seem to be plenty of ways of doing this right, just not my way!



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

Search: