getPermutations: Get random permutations of a set of elements
Description
The function arranges, in an optimized way, all the elements of a set into a selected number of different sequences (i.e., permutations). If the number of possible orderings is less than the required number, the function returns the collection of all possible permutations.
Usage
getPermutations(n, nperms)
Arguments
n
number of elements
nperms
number of required permutations
Value
The function returns:
perms: a matrix with nperms rows and n columns, containing the sequence of the ordered elements
all.perms.flag: 1 if the perms array contains the entire collection of permutations, 0 otherwise. In the first case, the number of rows of perms matrix may be less than the number of requested permutations