Permutations to scalars and back again.

James A. Donald jamesd at echeque.com
Mon Sep 12 02:28:10 PDT 2016


On 9/12/2016 11:52 AM, stef 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

That link describes the case of n distinct elements.  I have 
interchangeable elements.

Thus the set of possible permutations is reduced by (18!)^2

Thus the mapping described in that link is an unacceptably sparse mapping.



More information about the cypherpunks mailing list