public class PoissonSampler<T> extends Object implements RandomSampler<T,T>
param: fraction the sampling fraction (with replacement) param: useGapSamplingIfPossible if true, use gap sampling when sampling ratio is low.
Constructor and Description |
---|
PoissonSampler(double fraction) |
PoissonSampler(double fraction,
boolean useGapSamplingIfPossible) |
Modifier and Type | Method and Description |
---|---|
PoissonSampler<T> |
clone()
return a copy of the RandomSampler object
|
int |
sample()
Whether to sample the next item or not.
|
scala.collection.Iterator<T> |
sample(scala.collection.Iterator<T> items)
take a random sample
|
void |
setSeed(long seed)
Set random seed.
|
public PoissonSampler(double fraction, boolean useGapSamplingIfPossible)
public PoissonSampler(double fraction)
public void setSeed(long seed)
Pseudorandom
setSeed
in interface Pseudorandom
public int sample()
RandomSampler
sample
in interface RandomSampler<T,T>
public scala.collection.Iterator<T> sample(scala.collection.Iterator<T> items)
RandomSampler
sample
in interface RandomSampler<T,T>
public PoissonSampler<T> clone()
RandomSampler
clone
in interface RandomSampler<T,T>
clone
in class Object