RandomPermutation

RandomPermutation[gr]
gives a pseudorandom permutation in the permutation group gr.

RandomPermutation[gr,n]
gives a list of n pseudorandom permutations in the permutation group gr.

DetailsDetails

  • Permutations are returned with uniform distribution in the given group.
  • The result is given in disjoint cyclic form, with head Cycles.
  • RandomPermutation[d] and RandomPermutation[d,n] return permutations in the symmetric group of degree d.
  • RandomPermutation gives a different sequence of pseudorandom permutations whenever you run the Wolfram Language. You can start with a particular seed using SeedRandom.
  • A Method option to SeedRandom can be given to specify the pseudorandom generator used.

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

A random permutation in the symmetric group :

In[1]:=
Click for copyable input
Out[1]=

Five random permutations in the dihedral group of degree 10:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2010
(8.0)