public class UniformSample extends Object implements Sample
long
s. Uses Vitter's Algorithm R to produce a
statistically representative sample.Constructor and Description |
---|
UniformSample(int reservoirSize)
Creates a new
UniformSample . |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all recorded values.
|
Snapshot |
getSnapshot()
Returns a snapshot of the sample's values.
|
int |
size()
Returns the number of values recorded.
|
void |
update(long value)
Adds a new recorded value to the sample.
|
public UniformSample(int reservoirSize)
UniformSample
.reservoirSize
- the number of samples to keep in the sampling reservoirpublic void clear()
Sample
public int size()
Sample
public void update(long value)
Sample
public Snapshot getSnapshot()
Sample
getSnapshot
in interface Sample