[−][src]Crate reservoir_sampling
Crate implementing reservoir sampling, a method for getting random samples from a source in a single pass. Useful in situations where size of source is unknown or very large. Read this article for more information: https://en.wikipedia.org/wiki/Reservoir_sampling All algorithms implemented here have been taken from this article only.
API Design
Functions take:
- An iterator of generic type T, with no constraints which serves as a stream of data to sample.
- Mutable array slice to store sampled data
By default, functions userand::thread_rng
to provide RNG. To use your own RNG which implementsrand::RNG
, use functions inreservoir_sampling::core
Modules
core | |
unweighted |