Generates a random combination.

randcomb(a, m)

Arguments

a

numeric vector of some length n

m

integer with 0 <= m <= n

Details

Generates one random combination of the elements a of length m.

Value

vector of combined elements of a

Note

This behavior is different from Matlab/Octave, but does better correspond with the behavior of the perms() function.

See also

Examples

randcomb(seq(2, 10, by=2), m = 3)
#> [1] 4 6 2