This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

RandomPermutation

RandomPermutation[gr]
gives a pseudorandom permutation in the permutation group gr.
RandomPermutation
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 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.
A random permutation in the symmetric group :
Five random permutations in the dihedral group of degree 10:
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]=
Generate 10000 random permutations in a group:
They are generated with uniform distribution:
With degrees 0 or 1, or using the trivial group, you always get the identity permutation:
Use SeedRandom to get repeatable random permutations:
Use BlockRandom to block one use of RandomPermutation from affecting others:
New in 8