randcomb {pracma}R Documentation

Random Combination

Description

Generates a random combination.

Usage

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

combs, randperm

Examples

randcomb(seq(2, 10, by=2), m = 3)

[Package pracma version 2.4.4 Index]