Module rand::distributions::weighted
source · Expand description
Weighted index sampling
This module provides two implementations for sampling indices:
WeightedIndex
allowsO(log N)
samplingalias_method::WeightedIndex
allowsO(1)
sampling, but with much greater set-up cost
Modules
- This module contains an implementation of alias method for sampling random indices with probabilities proportional to a collection of weights.
Structs
- A distribution using weighted sampling to pick a discretely selected item.
Enums
- Error type returned from
WeightedIndex::new
.