I'm stuck at figuring out how to generate a specific permutation of a binary array.
Let's say I have a fixed length array of n elements. Each element can either be 0 or 1. The total amount of permutations is 2^n.
How can I generate a specific permutation k where 0 <= k < 2 ** n?
It doesn't matter how the arrays are populated with ones and zeroes as long as the algorithm is deterministic and always returns the same array for each k.