randsample
statistics: y = randsample (v, k)
statistics: y = randsample (v, k, replacement=false)
statistics: y = randsample (v, k, replacement=false, [w=[]])
Sample elements from a vector.
Returns k random elements from a vector v with n elements, sampled without or with replacement, with an optional weight vector.
If v is a scalar, samples from 1:v.
If a weight vector w of the same size as v is specified, the probability of each element being sampled is proportional to w. Unlike Matlab’s function of the same name, this can be done for sampling with or without replacement.
Randomization is performed using rand().
See also: datasample, randperm
Source Code: randsample