Example #1
0
 @Test
 public void testNormal() {
   final ProbabilityDistribution<Double> highDOF = new StudentTDistribution(1000000, ENGINE);
   final ProbabilityDistribution<Double> normal = new NormalDistribution(0, 1, ENGINE);
   final double eps = 1e-4;
   double x;
   for (int i = 0; i < 100; i++) {
     x = RANDOM.nextDouble();
     assertEquals(highDOF.getCDF(x), normal.getCDF(x), eps);
     assertEquals(highDOF.getPDF(x), normal.getPDF(x), eps);
     assertEquals(highDOF.getInverseCDF(x), normal.getInverseCDF(x), eps);
   }
 }