RandomPermutation
✖
RandomPermutation
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 allBasic Examples (2)Summary of the most common use cases
Scope (1)Survey of the scope of standard use cases
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:
In[1]:=1

✖
https://wolfram.com/xid/0dqwizpc66a-egziad
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/0dqwizpc66a-tod07h
Out[2]=2

In[3]:=3

✖
https://wolfram.com/xid/0dqwizpc66a-06egp5
Out[3]=3

In[4]:=4

✖
https://wolfram.com/xid/0dqwizpc66a-qyuyj9
Out[4]=4

In[5]:=5

✖
https://wolfram.com/xid/0dqwizpc66a-jdvrkg
Out[5]=5

Use SeedRandom to get repeatable random permutations:
In[1]:=1

✖
https://wolfram.com/xid/0dqwizpc66a-utg
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/0dqwizpc66a-tdk
Out[2]=2

Use BlockRandom to block one use of RandomPermutation from affecting others:
In[1]:=1

✖
https://wolfram.com/xid/0dqwizpc66a-wbm
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
]}
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
]}