Expand description
Low-level API for sampling indices
Enumsยง
- A vector of indices.
- Return type of
IndexVec::into_iter
. - Return type of
IndexVec::iter
.
Traitsยง
- UInt ๐
Functionsยง
- Randomly sample exactly
amount
distinct indices from0..length
, and return them in random order (fully shuffled). - Randomly sample exactly
amount
distinct indices from0..length
, and return them in an arbitrary order (there is no guarantee of shuffling or ordering). The weights are to be provided by the input functionweights
, which will be called once for each index. - sample_
floyd ๐Randomly sample exactlyamount
indices from0..length
, using Floydโs combination algorithm. - sample_
inplace ๐Randomly sample exactlyamount
indices from0..length
, using an inplace partial Fisher-Yates method. Sample an amount of indices using an inplace partial fisher yates method. - sample_
rejection ๐Randomly sample exactlyamount
indices from0..length
, using rejection sampling. - Randomly sample exactly
amount
distinct indices from0..length
, and return them in an arbitrary order (there is no guarantee of shuffling or ordering). The weights are to be provided by the input functionweights
, which will be called once for each index.