@Test
public void nextDoubleTestDistribution() {

    int[] res = new int[10];
    int error = 0;
    for (int i = 0; i < 1000; i++) {
        double number = random.nextDouble();
        if (number > 1.0d) {
            error++;
        } else if (number < 0.1d) {
            res[0]++;
        } else if (number < 0.2d) {
            res[1]++;
        } else if (number < 0.3d) {
            res[2]++;
        } else if (number < 0.4d) {
            res[3]++;
        } else if (number < 0.5d) {
            res[4]++;
        } else if (number < 0.6d) {
            res[5]++;
        } else if (number < 0.7d) {
            res[6]++;
        } else if (number < 0.8d) {
            res[7]++;
        } else if (number < 0.9d) {
            res[8]++;
        } else if (number < 1.0d) {
            res[9]++;
        }
    }
    // each possibility should at least appear half of the perfect distribution ( =(1/10)/2 = 0.05)
    assertTrue(res[0] / 1000d > 0.05);
    assertTrue(res[1] / 1000d > 0.05);
    assertTrue(res[2] / 1000d > 0.05);
    assertTrue(res[3] / 1000d > 0.05);
    assertTrue(res[4] / 1000d > 0.05);
    assertTrue(res[5] / 1000d > 0.05);
    assertTrue(res[6] / 1000d > 0.05);
    assertTrue(res[7] / 1000d > 0.05);
    assertTrue(res[8] / 1000d > 0.05);
    assertTrue(res[9] / 1000d > 0.05);
    assertEquals(0, error);
}