RandomPermutation
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 allBasic Examples (2)
Scope (1)
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:
Text
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.
APA
Wolfram Language. (2010). RandomPermutation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RandomPermutation.html