4 ms·
You want to use an ID that can predictably be unique for something like this. You shouldn't use a random string.
by staunch 18y ago
You want to use an ID that can predictably be unique for something like this. You shouldn't use a random string.
- aristus 18y agoWhat 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.
- jacktang 18y agowell, 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?