I have to generate identification number plates from a database ID. These ID are composed of three letters and three numbers e.g.
BAC 212, I already have a function that convert the internal ID to the plate number:
plate_encode(0) -> 'AAA-000' plate_encode(1) -> 'AAA-001' ... plate_decode('AAA-001') -> 1
To have a more uniform range for my plate numbers, I would like to shuffle these numbers before encoding them. This fonction act as the enigma machine, it is reversible:
seed = 32912 tumble(1, seed) -> 4839281 tumble(4839281, seed) -> 1
I could use the Enigma algorithm, but my corresponding table does not fit my plate range which is about ~2'800'000 values.
So the function I am looking for should take this additional parameter:
tumble(number, seed, max)
What kind of algorithm could I use?