@Test
public void testGet() {

    double[] probs = new double[] {0.1, 0.2, 0.3, 0.4};
    DiscreteRandomProducer producer = new DiscreteRandomProducer(0L, probs);
    Map<Integer, Double> counters = new HashMap<>();
    IntStream.range(0, probs.length).forEach(i -> counters.put(i, 0.0));
    final int N = 500000;
    Stream.generate(producer::getInt).limit(N).forEach(i -> counters.put(i, counters.get(i) + 1));
    IntStream.range(0, probs.length).forEach(i -> counters.put(i, counters.get(i) / N));
    for (int i = 0; i < probs.length; i++)
        assertEquals(probs[i], counters.get(i), 0.01);
    assertEquals(probs.length, producer.size());
}