this post was submitted on 24 Nov 2025
381 points (98.7% liked)

Programmer Humor

27500 readers
1525 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] NeatNit@discuss.tchncs.de 73 points 2 days ago (1 children)

Either this is faked for the meme or something is very very wrong.

[โ€“] wols@lemmy.zip 9 points 1 day ago* (last edited 1 day ago)

I'm leaning heavily towards faked for the meme.

If you actually were trying to get collisions, you'd save all previously generated ids and check all of them for a match with the newest one.
Not only would this increase the chance of a collision (not enough that it should matter, but still), but it would more closely approximate a real use case - if you use UUIDs you're not just in trouble if one specific id is duplicated, it's usually a problem if any id is not unique.
But the presented snippet is simpler and shorter and is close enough to what a naive test might look like, so it's well suited to getting the joke across.

The only way I could imagine this not being fake is if it was achieved in a noncompliant Js implementation. Which seems highly unlikely given the screenshot looks like the Chrome console.