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.
|
public DistributedIndexGenerator(int... percentages)
percentages
- the required percentage probabilities for indices 0, 1, ...Copyright © 2015. All Rights Reserved.