lundi 19 octobre 2020

Do repeated program executions increase chance of unique ID collisions

I know the point of unique id generators like UUID and nanoid is that collisions aren't supposed to happen for a very, very long time. But would subsequent re-executions of a program increase the chances?

Example: (I don't know much about RNG or UUID so this might not reflect the process entirely but this example will explain why I'm asking this question)

First execution: nanoid was initialized with a seed of 0. The chain of ids it'll produce will be A, B,C,D...etc. and we won't see A,B,C again for a long time in this particular chain so during this program execution, there's nothing to worry about.

Subsequent executions: nanoid initializing with a seed of 0 would be an obvious problem, but even if it weren't the same, I'm assuming the elements generated from a seed aren't unique to that seed alone.

  • seed 0 -> A,B,C,D......
  • seed 1 -> W,X,Y,Z.....A...B,C

so even if a different seed was chosen, it'll still be possible to reach the same IDs at some point.

Do I have the right idea, is this something worth worrying about?




Aucun commentaire:

Enregistrer un commentaire