private static StochasticSupplier<Double> normalVar(Optional<Double> min, Optional<Double> max, Optional<Double> mean, Optional<Double> std, Optional<Boolean> redraw) { checkArgument(min.isPresent(), "Min should be set."); checkArgument(max.isPresent(), "Max should be set."); checkArgument(mean.isPresent(), "Mean should be set."); checkArgument(std.isPresent(), "Std should be set."); checkArgument(redraw.isPresent(), "Redraw should be set."); final StochasticSuppliers.Builder builder = StochasticSuppliers.normal() .mean(mean.get()) .std(std.get()) .lowerBound(min.get()) .upperBound(max.get()); if (redraw.get()) { builder.redrawWhenOutOfBounds(); } else { builder.roundWhenOutOfBounds(); } return builder.buildDouble(); } }