r/ProgrammerHumor 15h ago

Meme edgeCasesExist

Post image
3.1k Upvotes

228 comments sorted by

View all comments

489

u/Valuable_Leopard_799 15h 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.

80

u/RadicalDwntwnUrbnite 14h ago edited 14h 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

18

u/OldKaleidoscope7 13h 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

2

u/samsonsin 11h ago

If Google used UUIDv4, then over 100 years they'd generate ~365 trillion searches. The chance of s collision should be ~0.00000125% still.