FUNCTION: RandPerm - return a random permutation
CALLING SEQUENCE:
- RandPerm(n)
- RandPerm(n, typeperm)
- SG[RandPerm](n)
- SG[RandPerm](n, typeperm)
-
PARAMETERS:
- n = any positive integer denoting the degree of a symmetric group
- typeperm = 'dominant', 'grassmannian'
SYNOPSIS:
- The RandPerm function generates a random permutation belonging to the
symmetric group of degree n.
- RandPerm(n, 'dominant') returns a random dominant permutation.
- RandPerm(n, 'grassmannian') returns a random grassmannian permutation.
- Whenever there is a conflict between the function name RandPerm and
another name used in the same session, use the long form
SG['RandPerm'].
EXAMPLES:
> with(SG):
> RandPerm(7);
[7, 4, 2, 3, 5, 1, 6]
> r := RandPerm(20, 'dominant');
r := [15, 11, 10, 12, 13, 7, 6, 8, 9, 14, 16, 5, 4, 17, 3, 18, 2,
19, 20, 1]
> Perm2Code(r);
[14, 10, 9, 9, 9, 6, 5, 5, 5, 5, 5, 4, 3, 3, 2, 2, 1, 1, 1, 0]
SEE ALSO: Perm2Code