Hacker News new | ask | show | jobs
by kaoD 304 days ago
Good observation. Could you share the math even if you don't trust it? I don't have pen and paper here and I'm curious.

After thinking it more, I have the feeling (against my initial intuition) that v4 might dominate either way unless you consistently generate tons of UUIDs for an impractical number of years.

1 comments

I ran some numbers by GPT-5[0], and for the scenario of generating 10k UUIDs in one ms every 10ms, over three years, it came up with a 0.0025% chance of collision for UUIDv7, and a 0.000000084% chance for collision with UUIDv4.

[0] https://kagi.com/assistant/dd7d8c48-44e4-499b-9f2f-33663d125...

I checked against my notes, I see about the same numbers using the `n**2` taylor series approximation. I missed that the probability of `>=1` collision is about the same as exactly one collision, but I suspect that's quite reasonable as this scale.