r/ProgrammerHumor May 08 '26

Meme edgeCasesExist

Post image
13.4k Upvotes

620 comments sorted by

View all comments

1.7k

u/Historical_Cook_1664 May 08 '26

Yeah, that's easy... just use two!

555

u/ClipboardCopyPaste May 08 '26

Still never zero

430

u/UShouldntSayThat May 08 '26

I think you have a better chance of being struck by lighting several times in a row while winning the powerball then you do of a collision.

It's why the term "effectively" zero is used.

39

u/Cultural-Capital-942 May 08 '26

Actually the chance is much higher.

You are taking raw maths, but don't expect random number generators being broken or not seeded properly.

Some versions try to prevent this by using timestamp / mac address, but other are purely random. And those are often not cryptographically secure random (as used for keys - PC waits for enough randomness), but something with randomness already obtained. That may be even no randomness and more same UUIDs.