sample

From STX Wiki
< Programmer Guide‎ | Command Reference‎ | EVAL
Revision as of 12:46, 21 April 2011 by 193.171.195.48 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Creates a random sample (subset) of a set.

Usage
sample(n , m)
n
the number of elements
m
the size of the random sample; 0 < m < n
Result
A vector with length m, containing the indices of the selected elements of the set.
It is assumed that the set is indexed from 0 to n-1 (i.e. the number of elements). The result vector can be applied as an index list on the set to extract the corresponding elements.
See also
rand, grand, shuffle, vsubn

<function list>

Navigation menu

Personal tools