up previous next
RandomSubsetIndices    --    indices for random subset


Syntax
RandomSubsetIndices(N: INT): LIST
RandomSubsetIndices(N: INT, K: INT): LIST

Description
These functions return a random subset of 1..N; the second form ensures that the cardinality is K. See also RandomSubset .

NOTE: the resulting list is sorted.

Example
/**/ RandomSubsetIndices(10);
[1, 3, 4, 5, 8, 10]
/**/ RandomSubsetIndices(10, 3);
[2,  3,  6]

See Also