public GaussianDistribution(double mu, double sigma) {
        this.mu = mu;
        this.sigma = sigma;
        variance = sigma * sigma;

        entropy = Math.log(sigma) + LOG2PIE_2;
        pdfConstant = Math.log(sigma) + LOG2PI_2;
    }
@Test
    public void testGaussianDistribution() {
        System.out.println("GaussianDistribution");
        MathEx.setSeed(19650218); // to get repeatable results.
        GaussianDistribution instance = new GaussianDistribution(3, 2.1);
        double[] data = instance.rand(1000);
        GaussianDistribution est = GaussianDistribution.fit(data);
        assertEquals(3.05, est.mu, 1E-2);
        assertEquals(2.13, est.sigma, 1E-2);
    }