 combinat - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Mathematics : Discrete Mathematics : Combinatorics : combinat : combinat/randperm

combinat

 randperm
 construct a random permutation

 Calling Sequence randperm( n )

Parameters

 n - list or set of objects, or positive integer

Description

 • If n is a list or set, then randperm returns a random permutation of the elements of n. If n is a positive integer, then a random permutation of the first n positive integers is returned.
 • The command with(combinat,randperm) allows the use of the abbreviated form of this command.

Examples

 > $\mathrm{with}\left(\mathrm{combinat},\mathrm{randperm}\right)$
 $\left[{\mathrm{randperm}}\right]$ (1)
 > $\mathrm{randperm}\left(3\right)$
 $\left[{3}{,}{2}{,}{1}\right]$ (2)
 > $\mathrm{randperm}\left(\left[a,b,c,d\right]\right)$
 $\left[{b}{,}{c}{,}{d}{,}{a}\right]$ (3)
 > $\mathrm{randperm}\left(\left\{W,X,Y,Z\right\}\right)$
 $\left[{X}{,}{W}{,}{Z}{,}{Y}\right]$ (4)

 See Also