|
The LCG is the improved extension which causes you to have to compute values x_0 = seed to x_n in order to calculate x_{n+1}. What I am talking about is just a mapping of index x -> f(x) which is what the OP seemed to have wanted. In that case, `a` only needs to be relatively prime. This cannot account for every permutation of n since the number of values relatively prime to n, the totient, has an upper bound of n, which is the possible values for a. The number of values for b is also n, so at most n^2 possible sequences are generated, which is less than n! for n > 3. For example, with n = 5:
Let a = 3 and b = 2.
x = [0, 1, 2, 3, 4],
a * x = [0, 3, 6, 9, 12],
a * x + b = [2, 5, 8, 11, 14],
a * x + b mod n = [2, 0, 3, 1, 4] |