Crate reservoir [] [src]

Reservoir sampling: collect a random sample of a known maximum size from an iterator of unknown length.

Implements Jeffrey Vitter's Algorithm R (see https://en.wikipedia.org/wiki/Reservoir_sampling)

Functions

sample

Return a random sample of a known maximum size from an iterator of unknown length.

sample_into

Collect a random sample of a known maximum size from an iterator of unknown length into an existing Vec.