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.

Details

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

Examples

open allclose all

Basic Examples  (2)

A random permutation in the symmetric group :

Five random permutations in the dihedral group of degree 10:

Scope  (1)

Generate 10000 random permutations in a group:

They are generated with uniform distribution:

Properties & Relations  (3)

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:

Wolfram Research (2010), RandomPermutation, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomPermutation.html.

Text

Wolfram Research (2010), RandomPermutation, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomPermutation.html.

BibTeX

@misc{reference.wolfram_2021_randompermutation, author="Wolfram Research", title="{RandomPermutation}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/RandomPermutation.html}", note=[Accessed: 23-September-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_randompermutation, organization={Wolfram Research}, title={RandomPermutation}, year={2010}, url={https://reference.wolfram.com/language/ref/RandomPermutation.html}, note=[Accessed: 23-September-2021 ]}

CMS

Wolfram Language. 2010. "RandomPermutation." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RandomPermutation.html.

APA

Wolfram Language. (2010). RandomPermutation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RandomPermutation.html