Invertible function that randomizes order
You are looking for a pseudorandom permutation on the set $\{0,1,2,\dots,n-1\}$.  In cryptography, this has been studied under the (counter-intuitive) name "format-preserving encryption".  There are a number of constructions you could use for your purposes.

There's a bunch of research literature on the problem, with different schemes that are optimized for different values of $n$.  You can also find some summaries on Cryptography.SE.

I recommend you start by reading the question and the answers at Lazily computing a random permutation of the positive integers and Encrypting a 180-bit plaintext into a 180 bit ciphertext with a 128-bit block cipher and What are the examples of the easily computable &quot;wild&quot; permutations?.