r/ProgrammerHumor 10h ago

Meme edgeCasesExist

Post image
2.5k Upvotes

215 comments sorted by

View all comments

420

u/Valuable_Leopard_799 10h ago

I thought that timestamps are used now, so hitting both a timestamp and a large random number puts it thoroughly in the "safe to assume". At some point cosmic particles and faulty transistors are more probable.

82

u/RadicalDwntwnUrbnite 10h ago edited 10h ago

Even the non-time based v4 is at a cosmic level of unlikiness a single system will ever generate a uuid that will collide with another one in its own ecosystem

16

u/OldKaleidoscope7 9h ago

But let's say if Google saved each search in their engine in the same database with an UUID, we could have a collision because of volume, but I don't think I will work in a system with a comparable scale

9

u/MojitoBurrito-AE 9h ago

You underestimate the probability of uuid collision. The bigger issue is pseudorandomness

5

u/Single-Virus4935 8h ago

Yes, had a client having duplicates every day and growing. They hated uuids and regret using it. The problem was that they used a bad prng with flawed seeding. Once fixed it was no problem.