WOLFRAM

gives a pseudorandom permutation in the permutation group gr.

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)Summary of the most common use cases

A random permutation in the symmetric group :

Out[1]=1

Five random permutations in the dihedral group of degree 10:

Out[1]=1

Scope  (1)Survey of the scope of standard use cases

Generate 10000 random permutations in a group:

They are generated with uniform distribution:

Out[2]=2

Properties & Relations  (3)Properties of the function, and connections to other functions

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

Out[1]=1
Out[2]=2
Out[3]=3
Out[4]=4
Out[5]=5

Use SeedRandom to get repeatable random permutations:

Out[1]=1
Out[2]=2

Use BlockRandom to block one use of RandomPermutation from affecting others:

Out[1]=1
Wolfram Research (2010), RandomPermutation, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomPermutation.html.
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.

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

CMS

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

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

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

BibTeX

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

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

BibLaTeX

@online{reference.wolfram_2025_randompermutation, organization={Wolfram Research}, title={RandomPermutation}, year={2010}, url={https://reference.wolfram.com/language/ref/RandomPermutation.html}, note=[Accessed: 28-March-2025 ]}

@online{reference.wolfram_2025_randompermutation, organization={Wolfram Research}, title={RandomPermutation}, year={2010}, url={https://reference.wolfram.com/language/ref/RandomPermutation.html}, note=[Accessed: 28-March-2025 ]}