StochasticSuppliers { public static Builder normal() { return new Builder(); } private  StochasticSuppliers(); static StochasticSupplier<T> constant(T value); static boolean isConstant(StochasticSupplier<T> supplier); static StochasticSupplier<T> empty(String errorMsg); static StochasticSupplier<T> checked(
      StochasticSupplier<T> supplier,
      Predicate<T> predicate); static StochasticSupplier<T> fromIterable(Iterable<T> iter); static StochasticSupplier<T> fromSupplier(Supplier<T> supplier); static Builder normal(); static StochasticSupplier<Double> uniformDouble(double lower,
      double upper); static StochasticSupplier<Integer> uniformInt(int lower, int upper); static StochasticSupplier<Long> uniformLong(int lower, int upper); static StochasticSupplier<Long> intToLong(
      StochasticSupplier<Integer> supplier); static StochasticSupplier<Integer> roundDoubleToInt(
      StochasticSupplier<Double> supplier); static StochasticSupplier<Long> roundDoubleToLong(
      StochasticSupplier<Double> supplier); static StochasticSupplier<MersenneTwister> mersenneTwister();  }
@Test public void testNormalScaleMean() { final double[] means = new double[] {1d, 2d, 3d, 10d, 100d}; final double[] sds = new double[] {1d, 1d, 3d, 5d, 100d}; for (int i = 0; i < means.length; i++) { final StochasticSupplier<Double> ss = StochasticSuppliers.normal() .mean(means[i]) .std(sds[i]) .lowerBound(0) .scaleMean() .redrawWhenOutOfBounds() .buildDouble(); final RandomGenerator rng = new MersenneTwister(123); final SummaryStatistics stats = new SummaryStatistics(); for (int j = 0; j < 10000; j++) { stats.addValue(ss.get(rng.nextLong())); } final double allowedDeviation = 0.01 * means[i]; assertEquals(means[i], stats.getMean(), allowedDeviation); } }