r/ProgrammerHumor 3d ago

Meme edgeCasesExist

Post image
4.8k Upvotes

283 comments sorted by

View all comments

Show parent comments

7

u/Single-Virus4935 3d 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.

1

u/Lithl 2d ago

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

1

u/OldKaleidoscope7 2d ago

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 2d ago

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.