Elements sampled from a vector.
Returns k random elements from a vector v with n elements, sampled without or with replacement.
If v is a scalar, samples from 1:v.
If a weight vector w of the same size as v is specified, the probablility 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.
Package: statistics