* Test method for 'ca.nengo.math.impl.GaussianPDF.sample()'
*/
public void testSample() {
int n = 1000;
GaussianPDF pdf = new GaussianPDF(0f, 1f);
assertEquals(1, pdf.sample().length);
int c = 0;
for (int i = 0; i < n; i++) {
float sample = pdf.sample()[0];
if (sample > -1f && sample < 1f) c++;
}
ourLogger.info("GaussianPDFTest c: " + c);
assertTrue(c > 620 && c < 740); //should be about 682 but will vary randomly
pdf = new GaussianPDF(-10f, 4f);
assertEquals(1, pdf.sample().length);
c = 0;
for (int i = 0; i < n; i++) {
float sample = pdf.sample()[0];
if (sample > -12f && sample < -8f) c++;
}
ourLogger.info("GaussianPDFTest c: " + c);
assertTrue(c > 620 && c < 740);
}