% $Date: 2003/09/15 16:37:45 $ $Author: nthiery $ $Revision: 1.1.1.1 $

\begin{Mhelppage}{RandPerm}{V. Prosper}

  \begin{MInfo}
    \eng{returns a random permutation}
  \end{MInfo}
  
  \MDeclareOption{\type}{type}

  \begin{MCalls}
    \Mcall{n\Mopt{,\type}}
  \end{MCalls}

  \begin{MParameters}
    \param{n}
    \eng{degree of a symmetric group (positive integer)}
  \end{MParameters}
  \begin{MOptions}
    \option{\type=dominant,grassmannian}
  \end{MOptions}

  \begin{MIntro}
    \eng{The {\Mthis} function generates a random permutation
      belonging to the symmetric group of degree \Mex{n}.

      \Mex{\Mthis(n, dominant)} returns a random dominant permutation.
 
      \Mex{\Mthis(n, grassmannian)} returns a random grassmannian permutation.
      }
  \end{MIntro}

\begin{MExample}{ex1}
\begin{Mvin}{test=false}
muEC::SG::RandPerm( 7 );
\end{Mvin}
\begin{Mvout}{test=false}
                     [7, 4, 2, 3, 5, 1, 6]
\end{Mvout}
\begin{Mvin}{test=false}
muEC::SG::RandPerm( 20, dominant );
\end{Mvin}
\begin{Mvout}{test=false}
[14, 11, 10, 12, 9, 6, 7, 5, 3, 4, 2, 8, 13, 15, 1, 16, 17,

   18, 19]
\end{Mvout}
\begin{Mvin}{test=false}
muEC::SG::Perm2Code( % );
\end{Mvin}
\begin{Mvout}{test=false}
  [13, 10, 9, 9, 8, 5, 5, 4, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0]
\end{Mvout}
\end{MExample}

\MRelatedFunctions{Perm2Code}
\end{Mhelppage}
