Peter Hendrickson proposed the problem of how to successively choose numbers, seemingly at random, from some range (power of two here) while avoiding duplication. One goal is to avoid letting an adversary guess what number is next. This could also simulate dealing from a shuffled deck of cards. It can be used to assign serial numbers while disguising the order they were assigned. The real order is available to anyone with knowledge of the key.
state -> (state, number)When all numbers in the range have been chosen the function yields an error.
My solution is a Feistel network using a secret key and fed by a counter that steps thru the range. The state is the counter and the number yielded would be the counter encrypted by the Feistel cypher. The Feistal network can be adjusted to any number of bits. If the range is not a power of two then the next larger power can be used and any counter value whose encryption exceeds the range is skipped over.
Knowing the key allows producing this number sequence in either order. Knowledge of the key and number allows efficient computing of the counter.