Effectively what I'm looking for is a function f(x)
that outputs into a range that is pre-defined. Calling f(f(x))
should be valid as well. The function should be cyclical, so calling f(f(...(x)))
where the number of calls is equal to the size of the range should give you the original number, and f(x)
should not be time dependent and will always give the same output.
While I can see that taking a list of all possible values and shuffling it would give me something close to what I want, I'd much prefer it if I could simply plug values into the function one at a time so that I do not have to compute the entire range all at once.
I've looked into Minimal Perfect Hash Functions but haven't been able to find one that doesn't use external libraries. I'm okay with using them, but would prefer to not do so.
If an actual range is necessary to help answer my question, I don't think it would need to be bigger than [0, 2^24-1]
, but the starting and ending values don't matter too much.