reservoir sampling
val create : ?random_state:Core.Random.State.t ‑> int ‑> 'a tcreate ~random_state desired_sample_size creates an empty sample of 'a values.
The sample will grow no larger than desired_sample_size when presented with more
values by calling add.
val maybe_add : 'a t ‑> 'a ‑> unitmaybe_add t x will randomly either add x to t or ignore it. If adding x
would grow the sample larger than desired_sample_size t, some previously selected
value will be discarded.
val to_list : 'a t ‑> 'a listthe current selection from values previously seen by t. Of all previously seen
values, each subset of size desired_sample_size t is equally likely to have
been selected.
val select : ?random_state:Core.Random.State.t ‑> next:(unit ‑> 'a option) ‑> int ‑> 'a listrandomly select a subset of size sample_size from a stream of unknown length.
Each possible subset is chosen with equal probability.
val num_seen : _ t ‑> intnumber of things maybe_added so far, no matter they're actually added or ignored
val clear : _ t ‑> unitclear t clears contents of t and resets num_seen. It doesn not reset random
state