Crate reservoir_sampler[][src]

Expand description

This crate only provide a “standard” trait about what a streaming sampler using the [Reservoir Algorithm] can do. In My opinion, given a Whole consists of a same type of Item, the sampler can decide whether it should sample an item when the item passes through, and no matter when, the sampler should know which samples it currently holds. When the sampler decided not to accept any new sample more, it can lock the result.

Reservoir Algorithm



A Reservoir is a just a pool, but for random number generation, total items’ count passed through is known.