Suppose I have a sequence of numbers: {n, n + 1, n + 2, ... n + m}
Without saving the numbers ahead of time, I want to create a function f (), which sets the sequence {1,2,3, ... m}, will spit out the original set in a random (or at least pseudo random) order.
For example, suppose my sequence is {10, 11, 12, 13, 14, 15, 16, 17}
f (1) could yield 14
f (2) could yield 17
f (3) could yield 13
f (4) could yield 10
f (5) could yield 16
f (6) could yield 15
f (7) could yield 11
f (8) could yield 12
At some point in the past, an employee showed me a mathematical algorithm that could do this, but since then I forgot almost everything about it, except that it existed. I remember that you had to have a sequence in advance and generate some constants from the sequence that were used in the function. And for those who wondered, I, unfortunately, lost contact with this employee.
This question answers almost the way I want, but I'm not sure if the answers allow me to limit the output to a certain sequence ahead of time.
Edit:
To clarify a bit more, I don't want to keep the original sequence or shuffled sequence. I want to generate the f () function from the original sequence.
What is disappointing is that I saw this, I just can't remember enough to find it again with Google.
The Fisher-Yates algorithm is great for swapping or shuffling the deck, but that's not what I'm looking for.