Description
The GaussianSampler requires the standard deviation is strictly positive. It allows an infinite value. This will produce a NaN output if the NormalizedGaussianSampler returns 0:
@Test public void testInfiniteStdDev() { NormalizedGaussianSampler gauss = new NormalizedGaussianSampler() { @Override public double sample() { return 0; } }; GaussianSampler s = new GaussianSampler(gauss, 0, Double.POSITIVE_INFINITY); Assert.assertEquals(Double.NaN, s.sample(), 0.0); }
A fix is to require the standard deviation is finite.