gives a pseudorandom permutation in the permutation group gr.

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


  • 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 Mathematica. 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 :

Click for copyable input

Five random permutations in the dihedral group of degree 10:

Click for copyable input
New in 8
New to Mathematica? Find your learning path »
Have a question? Ask support »