Documentation of 'cc.redberry.core.groups.permutations.RandomPermutation' Java class
RandomPermutation
cc.redberry.core.groups.permutations

Class RandomPermutation



  • public final class RandomPermutation
    extends java.lang.Object
    Algorithms for generating uniform distributed random elements of permutation group.

    Example:

    In the following example we use a two generators, which generates a group of order 5616 and choose 5616 random elements of this group with uniform distribution

     //primitive permutation group with 5616 elements
     Permutation perm1 = new PermutationOneLineInt(9, 1, 2, 0, 4, 8, 5, 11, 6, 3, 10, 12, 7);
     Permutation perm2 = new PermutationOneLineInt(2, 0, 1, 8, 3, 5, 7, 11, 4, 12, 9, 6, 10);
     ArrayList<Permutation> generators = new ArrayList<>(Arrays.asList(perm1, perm2));
     //we'll use a list of generators as a source of randomness
     //this brings some randomization in generators list
     RandomPermutation.randomness(generators);
     Set<Permutation> set = new HashSet<>();
     int k = 5616; //equal to order of group
     //choosing 5616 random elements
     for (; k > 0; --k)
         set.add(RandomPermutation.random(generators));
     //uniform
     System.out.println(set.size());//~3500
     

    Since:
    1.1.6

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.