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.