({{, (RefLink[RandomPermutation, paclet:ref/RandomPermutation])[gr] 
gives a pseudorandom permutation in the permutation group gr.}, {, (RefLink[RandomPermutation, paclet:ref/RandomPermutation])[gr,n]
gives a list of n pseudorandom permutations in the permutation group gr.}})

OpenersNotesSection(Spacer1)Details

Permutations are returned with uniform distribution in the given group.

The result is given in disjoint cyclic form, with head (RefLink[Cycles, paclet:ref/Cycles]).

(RefLink[RandomPermutation, paclet:ref/RandomPermutation])[d] and (RefLink[RandomPermutation, paclet:ref/RandomPermutation])[d,n] return permutations in the symmetric group of degree d.

(RefLink[RandomPermutation, paclet:ref/RandomPermutation]) gives a different sequence of pseudorandom permutations whenever you run the Wolfram Language. You can start with a particular seed using (RefLink[SeedRandom, paclet:ref/SeedRandom]).

A (RefLink[Method, paclet:ref/Method]) option to (RefLink[SeedRandom, paclet:ref/SeedRandom]) can be given to specify the pseudorandom generator used.

OpenersPrimaryExamplesSection(Spacer1)Examples  (6)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

A random permutation in the symmetric group (Subscript[S, 10]):

RandomPermutation[10]

Five random permutations in the dihedral group of degree 10:

RandomPermutation[DihedralGroup[10],5]

OpenersExampleSection1(Spacer1)Scope  (1)

Generate 10000 random permutations in a group:

perms=RandomPermutation[PermutationGroup[{Cycles[{{1,2}}],Cycles[{{1,3},{2,4}}],Cycles[{{3,5},{4,6}}]}],10000];

They are generated with uniform distribution:

ListPlot[Last/@Tally[perms],PlotRange->{0,300}]

OpenersExampleSection3(Spacer1)Properties & Relations  (3)

With degrees 0 or 1, or using the trivial group, you always get the identity permutation:

RandomPermutation[0]

RandomPermutation[1]

RandomPermutation[PermutationGroup[{}]]

RandomPermutation[SymmetricGroup[1]]

RandomPermutation[AlternatingGroup[2]]

Use (RefLink[SeedRandom, paclet:ref/SeedRandom]) to get repeatable random permutations:

{RandomPermutation[5],RandomPermutation[5]}

{SeedRandom[1234];RandomPermutation[5],SeedRandom[1234];RandomPermutation[5]}

Use (RefLink[BlockRandom, paclet:ref/BlockRandom]) to block one use of (RefLink[RandomPermutation, paclet:ref/RandomPermutation]) from affecting others:

{BlockRandom[RandomPermutation[5]],RandomPermutation[5]}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Cycles, paclet:ref/Cycles])  ▪  (RefLink[RandomChoice, paclet:ref/RandomChoice])  ▪  (RefLink[RandomSample, paclet:ref/RandomSample])  ▪  (RefLink[SeedRandom, paclet:ref/SeedRandom])  ▪  (RefLink[BlockRandom, paclet:ref/BlockRandom])  ▪  (RefLink[GroupElements, paclet:ref/GroupElements])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Permutations, paclet:tutorial/Permutations])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Permutations, paclet:guide/Permutations])}, {▪(RefLinkPlain[Random Number Generation, paclet:guide/RandomNumberGeneration])}})}})