this post was submitted on 24 Nov 2025
357 points (99.2% liked)

Programmer Humor

27490 readers
1557 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 68 points 1 day ago (1 children)

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

[โ€“] wols@lemmy.zip 8 points 16 hours 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 two consecutive ids are identical, it's usually a problem if any two ids are.
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.