T - The type of the sampler.public class Reservoir<T> extends Sampler<T>
| Modifier and Type | Class and Description |
|---|---|
static class |
Reservoir.IntermediateSample<T>
An intermediate sample
|
emptyIterable, EPSILON| Constructor and Description |
|---|
Reservoir(int numSamples)
Create a new sampler with reservoir size and a default random number generator.
|
Reservoir(int numSamples,
long seed)
Create a new sampler with reservoir size and the seed for random number generator.
|
Reservoir(int numSamples,
Random random)
Create a new sampler with reservoir size and a supplied random number generator.
|
| Modifier and Type | Method and Description |
|---|---|
Iterator<T> |
sample(Iterator<T> input)
Randomly sample the elements from input in sequence, and return the result iterator.
|
public Reservoir(int numSamples,
Random random)
numSamples - Maximum number of samples to retain in reservoir, must be non-negative.random - Instance of random number generator for sampling.public Reservoir(int numSamples)
numSamples - Maximum number of samples to retain in reservoir, must be non-negative.public Reservoir(int numSamples,
long seed)
numSamples - Maximum number of samples to retain in reservoir, must be non-negative.seed - Random number generator seed.Copyright © 2022 CDAP Licensed under the Apache License, Version 2.0.