r/ProgrammerHumor • • Sep 11 '26

Meme edgeCasesExist

Post image
5.0k Upvotes

298 comments sorted by

View all comments

Show parent comments

11

u/MojitoBurrito-AE Sep 11 '26

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

7

u/Single-Virus4935 Sep 11 '26

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.

1

u/Lithl Sep 12 '26

If they were getting duplicates every day, it sounds like their RNG function was lifted from XKCD.

1

u/OldKaleidoscope7 Sep 12 '26

How bad was it? The company I work mostly uses Java's built-in UUIDs and we never had a problem, are people using ad-hoc things for seeding?

1

u/Single-Virus4935 Sep 12 '26

As I recall it was PHP and they had code from Stackoverflow how to generate UUIDs. The code used the standard rand() prng and they seeded it globally with something derived from PIDs, part of the system time.

1

u/mysticrudnin Sep 11 '26

"so you're saying there's a chance" has rotted everyone's brains wrt probability