public class RandomSampler extends java.lang.Object implements Sampler.SubSampler
RandomSampler
is an implementation of the Sampler.SubSampler
interface.
RandomSampler
samples the data from [0, dataset.size) randomly.
Constructor and Description |
---|
RandomSampler()
Creates a new instance of
RandomSampler . |
RandomSampler(int seed)
Creates a new instance of
RandomSampler with the given seed. |
Modifier and Type | Method and Description |
---|---|
java.util.Iterator<java.lang.Long> |
sample(RandomAccessDataset dataset)
Fetches an iterator that iterates through the indices of the given
RandomAccessDataset . |
public RandomSampler()
RandomSampler
.public RandomSampler(int seed)
RandomSampler
with the given seed.seed
- the value of the seedpublic java.util.Iterator<java.lang.Long> sample(RandomAccessDataset dataset)
RandomAccessDataset
.sample
in interface Sampler.SubSampler
dataset
- the RandomAccessDataset
to sample fromRandomAccessDataset