And the wikipedia page https://en.wikipedia.org/wiki/Combinatorial_number_system. If you want some more theoretical stuff, Knuth has a chapter about combinations that's easily googleable. Mark On 12 Sep 2016 03:01, "stef" <s@ctrlc.hu> wrote:
On Mon, Sep 12, 2016 at 11:09:06AM +1000, James A. Donald wrote:
I need to be able to do two of the following three tasks.
Generate a permutation of eighteen ones and eighteen zeros with equal probability for each permutation. Or equivalently shuffle eighteen black cards and eighteen red cards.
Sequentially generate all possible permutations with each permutation generated once and only once.
Map between permutations and scalars, such that each permutation maps to unique number, and the set of numbers that represents valid permutations is dense.
Could someone point me to the relevant literature, or literature for converting between different representations of a permutation?
Since there are only two classes of items being shuffled, this class of permutations has a variety of special and convenient properties.
https://stackoverflow.com/questions/1506078/fast-permutation-number- permutation-mapping-algorithms
-- otr fp: https://www.ctrlc.hu/~stef/otr.txt