'How can I generate a unique, predictable, repeatable, non sequential alphanumeric identifier?
I have to generate identifiers composed of four alphanumerical characters, e.g. B41F.
I have the following requirements:
- Each identifier must be unique (there is no central location to lookup existing identifiers)
- The identifier must not be obviously sequential (e.g. 1A01, 1A02)
- It must be predictable
- It must be repeatable using solely the identifier index (on two different environment, the Nth identifier generated, which has index N, must be the same)
The problem is generic to any language. My implementation will be done in dart.
I think this could be done with a PRNG and some LUT, but I could not find any implementation or pseudo-code that respects requirement 4) without replaying the whole sequence. Also, some PRNG implementation have a random component that is not guaranteed to be repeatable over library update.
How can I achieve this? I'm looking for pseudo-code, code or hints.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
