ReservoirSampler<T> class

Reservoir sampler following the algorithm in https://en.wikipedia.org/wiki/Reservoir_sampling

Inheritance

Constructors

ReservoirSampler(int limit, {Random? random})

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
totalCount int
The total number of items added to the sampler.
no setterinherited

Methods

add(T item) → void
Add an item to the sampler.
override
addAll(Iterable<T> items) → void
Add multiple items to the sampler.
inherited
getSample() List<T>
The current sample, with the active (non-copy) backing list.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited