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

What do you mean by "predictably unique"? Do you mean "guaranteed unique"?

As a way to generate unique ids this isn't horrible. 12^62 is something like 220 bits. The odds of a collision are even lower than with a UUID.

Guaranteed uniqueness is preferred, yes. But the level of effort needed to guarantee uniqueness across a large application / dataset / etc is much higher than "unique enough", just as it's a lot more expensive to prove a number is prime than to generate a number that is 99.9999% probably prime.



well, even 99.9999% possible, we should handle the 0.0001% exception ;) Can I understand that, if collision occurs, let the it generate the id again?


That would be guaranteeing uniqueness. Don't bother guaranteeing uniqueness. The 99.99999% was an understatement. 12^62 is 99.999999999999999999999999999999999999999999999999999999999992% unique. This is higher odds than being killed by a meteorite.


:) thanks




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

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

Search: