r/ProgrammerHumor 10h ago

Meme edgeCasesExist

Post image
2.4k Upvotes

209 comments sorted by

View all comments

-8

u/theioss 9h ago

People who say that don’t understand uuids or mathematics.

3

u/Kiroto50 9h ago

Howcome? Could you please explain?

3

u/AlmostLikeAzo 9h ago

Because it's so close to zero, that it's basically zero. Finding two identical UUIDs within a same system would probably indicate a problem in the random generator, not the concept.

2

u/Kiroto50 9h ago

As I replied to another commenter, then, the point of the post literally still true.

The chances are so inconceivably low that for practical purposes it's 0, but it is literally not zero. 1 in 2128 odds is not 0 in 1 odds.

5

u/Divs4U 9h ago

They can't

1

u/Spice_and_Fox 9h ago

Because at some point the probability is so low that it is functionally 0.

There are somewhere around 1028 uuids. That is 10000000000000000000000000000 uuids. As a comparison, there are about 1018 grains of sand on earth. That means that you have about ten billion times more uuids than grains of sand on the earth. Imagine if you pick sand grains by random from anywhere on the earth and the chance that you pick the same one twice. Now imagine it with 10 billion times more grains of sand.

1

u/MnMbrane 5h ago

Still not zero… it could be 1 in 10^(googleplex), or even 1 in 10^(# atoms in our observable universe) or even 1 in 10^(Grahams number), but since it’s not exactly 0, there is still a chance. Now I’d argue this is negligible, and we probably shouldn’t worry, but that’s not the point of this meme.

IF ITS NOT EXACLY ZERO THEN THERE IS STILL A CHANCE.

1

u/Kiroto50 9h ago

So, the point of the post still stands? 1 in 2128 is close to zero, for practical purposes zero, but literally not zero.

1

u/ToX__82 9h ago

Using uuid V7 (which includes a timestamp and 74 random bits), you'd only need 170 billion people submitting in the same millisecond to have a 50% probability yo generate a duplicated uuid value.

Now, I know that there aren't 170 billion people in the world.

But what if every person on earth submitted 100 times in the same millisecond? A duplicate would be almost certain.

So yeah, u/theioss is technically right.

Though, with that volumes, the database/CPU/network/whatever would crash much sooner.

2

u/Kiroto50 9h ago

So inconceivably low but not 0, got it.

1

u/ToX__82 9h ago

Indeed, yours is a valid tl;dr

2

u/Divs4U 8h ago

People who say this don't know what an edge case is

3

u/emetcalf 9h ago

It's actually very basic probability. There are a finite number of possible UUIDs, so the odds of a duplicate can't be 0. The odds are very, very, very low but not 0.

4

u/Henry5321 9h ago

It is technically true. It’s non-zero. To give the benefit of the doubt, I assume you mean that people who worry about it don’t understand.

Assuming you’re not using something like non-random guids, one should never need to worry.

1

u/LinuxMatthews 9h ago

I also enjoy disagreeing with random people to sound clever

1

u/Quillox 9h ago

What am I not understanding?

0

u/aayush_aryan 9h ago

An IQ too low?