Lets assume an ordered finite sequence of integers A = {0,1,2, ... k}
.
Im looking for a (seeded) function f: A -> A
where the image of f
seems to be ramdom, but every element is hit exactly once (bijective).
It's importatant that someone who has access to some results of f
should neither be able to estimate if he's looking at direkt neighbours f(n), f(n+1)
nor should he be able to guess the next result.
One idea would be to map a range(1, k)
on a shuffle(range(1, k))
. But this seems very low in performance (for large k
) and does miss the basic idea of a generator. The first element in the sequece should be as expensive to calculate as the n
-th element.
Difference to 'normal' randomgenerators
Read carefully before marking as dublicated. I'm not looking for randomly picking from a range where collisions are possible. Also I want to calculate the n
-th element without calculating all n-1
elements before, like I would have to using the MT or Xorshift.