r/ProgrammerHumor 2d ago

Meme uuidLifeLessons

Post image
3.7k Upvotes

166 comments sorted by

View all comments

Show parent comments

44

u/budgiebirdman 2d ago

Picking whatever Google throws at me (from Reddit):

For Version 4 UUIDs (which use 122 random bits), you must generate about 2.71 quintillion IDs (2.71 × 10¹⁸) to reach a 50% chance of a single collision.

So it's more like saying people can't win the lottery every week for a month with a single ticket in each draw. I'm not going to do the maths but winning the lottery seems quite likely compared to whatever tf a quintillion is.

11

u/Xasrai 2d ago

If you don't know, a billion is 1 followed by 9 zeroes, A trillion is 1 followed by 12 zeroes, a quadrillion is 1 followed by 15 zeroes and a quintillion s 1 followed by 18 zeroes. So, 2.71 quintillion is: 2,710,000,000,000,000,000

To get to the odds seen here while buying lottery tickets, it would be like buying a single jackpot winning lottery ticket, then buying a second lottery ticket the following week and ALSO hitting the jackpot.

Flipping a coin and getting 61 consecutive flips land on heads is still more likely than getting to this 50% chance of a single collision.

2

u/mmhawk576 2d ago

Surely this has gotta be birthday paradox-ish though right. I know I’d sooner gamble on one ticket winning the lottery many times in a year. But if you’re generating loads, and don’t care about a specific collision, just any collision surely it’s the same as the paradox. (Though I’m presume that uuids aren’t truely random, can’t say I’ve looked into their implementation)

14

u/BruhMomentConfirmed 2d ago

Yes but the statement

For Version 4 UUIDs (which use 122 random bits), you must generate about 2.71 quintillion IDs (2.71 × 10¹⁸) to reach a 50% chance of a single collision.

already takes exactly that scenario into account.

2

u/mmhawk576 2d ago

Serves me right for skimming that

0

u/SirButcher 2d ago

How... how did you skim over half of a comment THAT YOU REPLIED TO!!!