#sampler #reservoir #matter #algorithm #sample #lock

reservoir-sampler

A trait API that A sampler using the Reservoir algorithm should implement

2 unstable releases

0.1.0 May 15, 2021
0.0.1 May 4, 2021

#5 in #reservoir


Used in choosen

LGPL-3.0-or-later

5KB
64 lines

Choosen

An easy program that choose some attending person, with equal properbility for each position.


lib.rs:

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

Dependencies

~310KB