@{Permutation&} {random()} {Rearrange the permutation in random order.}@  
 
@ {int} {rank()} {Return the rank of the permutation, ie. the position
of the permutation in lexicographic order.  The ranks run from 0 to $n!-1$.
}@ 

@ {Permutation&} {unrank(int m)} {Unrank the $m$th permutation, ie. change
the current permutation to the $m$th permutation in lexicographic order.}@  
 
@{Permutation&} {next()}
{Change the permutation to its successor in lexicographic order.}

@{Permutation&} {previous()}
{Change the permutation its predecessor in lexicographic order.}

@ {Permutation&} {first()} {Change the permutation to the first permutation
in lexicographic order, the identity permutation.}@

@ {Permutation&} {last()} {Change the permutation to the last permutation
in lexicographic order, the reverse of the identity permutation.}@

@ {void} {display()} {Display the permutation in human-readable form.}@

@~{Bool} {operator==(Permutation& p)}
  {Bool} {operator>(Permutation& p)}
  {Bool} {operator>=(Permutation& p)}
  {Bool} {operator<(Permutation& p)}
  {Bool} {operator<=(Permutation& p)}
  {Bool} {operator!=(Permutation& p)}~
{Compare two permutations according to lexicographic order.}@

@{friend istream&} {operator>>(istream& s,Permutation p)}
{Input p from input stream s.}@

@{friend ostream&} {operator<<(ostream& s,Permutation p)}
{Output p to output stream s.}@

@~{Permutation&} {operator=(Permutation p)}
 {Permutation&} {copy(Permutation p)}~
{Creates a copy of permutation p.}@

@ {Type} {operator[] (int i) }
{Return the value of the $i$th element of the permutation.
If the permutation was constructed from the element of the set,
an element is returned, otherwise it is an integer from 1 to $n$.
}@

@ {int} {size()} {Return size of the permutation}@

