Expand description
Entropy-efficient bounded random sampling.
EntropyPool keeps an internal uniform state (b, m) and recycles the
parts of that state that a bounded draw does not consume. This avoids modulo
bias while allowing later draws to reuse residual entropy.
§Example
use entropy_pool::EntropyPool;
let mut pool = EntropyPool::new();
let value = pool.gen_range(6);
assert!(value < 6);
let permutation = pool.permutation(3, 10);
assert_eq!(permutation.len(), 3);
let combination = pool.combination(5, 20);
assert_eq!(combination.len(), 5);Structs§
- Entropy
Pool - A bounded sampler that reuses residual entropy between draws.
Enums§
- Entropy
Pool Error - Errors returned by the checked sampling methods.