4 ms·
A billion is not that big of a number for UUIDs
by duped 3y ago
A billion is not that big of a number for UUIDs
- ceejayoz 3y agoRe-read. You'd have to generate 103 trillion to have a one billionth chance of a collision. A billion isn't that big a number, but 103 trillion is.
- jandrewrogers 3y agoI think you made a mistake in your math. The Birthday Collision probability of just a trillion random UUID is much higher than that.
- ceejayoz 3y agoFeel free to update https://en.wikipedia.org/wiki/Universally_unique_identifier#Collisions https://en.wikipedia.org/wiki/Universally_unique_identifier#..., but it does note "This probability can be computed precisely based on analysis of the birthday problem". It does show the formula used.
- deathanatos 3y agoWikipedia is correct, AFAICT. The probability of 1 trillion UUIDs having a collision is, def birthday_collision(n, m): return 1 - math.e ** (-((n -1) * n) / (2 * m)) In : birthday_collision(1_000_000_000_000, 2 ** 122) Out: 9.403589018575076e-14 That number is roughly the approximation given in Wikipedia. I.e., at 1T UUIDs, it hasn't happened. For comparison, the odds of being struck by lighting (over a lifetime) is many orders of magnitude greater: 6.535947712418301e-05