Apache Commons logo Apache Commons RNG

Apache Commons RNG: Random Numbers Generators

Commons RNG provides implementations of pseudo-random numbers generators that are either faster or of higher quality (and sometimes both) than java.util.Random.

The "client API" module contains the code that defines the API for client code.

Example:

import org.apache.commons.rng.UniformRandomProvider;

public class Dice {
    public int roll(UniformRandomProvider rng) {
        return 1 + rng.nextInt(6);
    }
}

Browse the Javadoc to see the complete API.