Expand description
Weighted (index) sampling
This module is a superset of rand::distr::weighted.
Multiple implementations of weighted index sampling are provided:
WeightedIndex(a re-export fromrand) supports fast construction andO(log N)sampling overNweights. It also supports updating weights withO(N)time.WeightedAliasIndexsupportsO(1)sampling, but due to high construction time many samples are required to outperformWeightedIndex.WeightedTreeIndexsupportsO(log N)sampling and update/insertion/removal of weights withO(log N)time.
Structs§
- Weighted
Alias Index - A distribution using weighted sampling to pick a discretely selected item.
- Weighted
Index - A distribution using weighted sampling of discrete items.
- Weighted
Tree Index - A distribution using weighted sampling to pick a discretely selected item.
Enums§
- Error
- Invalid weight errors
Traits§
- Aliasable
Weight - Weight bound for
WeightedAliasIndex - Weight
- Bounds on a weight