29 ms·
This answer is assuming you want to sacrifice collision resistance for length (seems dubious for anything that needs to be highly reliable) and that you don't w
by davidajackson 6y ago
This answer is assuming you want to sacrifice collision resistance for length (seems dubious for anything that needs to be highly reliable) and that you don't want to use auto-incrementing. Assuming your UUIDs are sufficiently random, isn't this just a generalized birthday problem? Take the birthday problem and generalize the formula from 365 buckets to N buckets, where N is the total number of possible UUIDs given a length and set of possible characters.
https://mste.illinois.edu/courses/mat764fa03/folders/edwardssu/Tech_Port/ThesisPape02.html https://mste.illinois.edu/courses/mat764fa03/folders/edwards...
You should be concerned with what happens if there's a duplicate -- you can calculate the probability of that occurring as long as you know the potential size of your dataset and set your UUID length accordingly.