Permutations to scalars and back again.

stef s at ctrlc.hu
Sun Sep 11 18:52:46 PDT 2016


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


More information about the cypherpunks mailing list