public class DistributedIndexGenerator extends Object
DistributedIndexGenerator gen = new DistributedIndexGenerator(30, 40);will create iterators that produce values from the set {0, 1, 2} randomly, where the probabilities of occurrence are 30%, 40%, and 30% respectively.
Iterator<Integer> it = gen.iterator(10);returns an iterator that will generate 10 such random values.
Constructor and Description |
---|
DistributedIndexGenerator(int... percentages)
Constructs a generator that uses the specified distribution.
|
Modifier and Type | Method and Description |
---|---|
Iterator<Integer> |
iterator(int count)
Returns an iterator which will return the specified number of random indices drawn from the
distribution configured for this generator.
|
String |
toString() |
public DistributedIndexGenerator(int... percentages)
percentages
- the required percentage probabilities for indices 0, 1, ...Copyright © 2016. All Rights Reserved.