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 overN
weights. It also supports updating weights withO(N)
time.WeightedAliasIndex
supportsO(1)
sampling, but due to high construction time many samples are required to outperformWeightedIndex
.WeightedTreeIndex
supportsO(log N)
sampling and update/insertion/removal of weights withO(log N)
time.
Structs§
- A distribution using weighted sampling to pick a discretely selected item.
- A distribution using weighted sampling of discrete items.
- A distribution using weighted sampling to pick a discretely selected item.
Enums§
- Invalid weight errors
Traits§
- Weight bound for
WeightedAliasIndex
- Bounds on a weight