public LogNormalDistribution(double mu, double sigma) {
        if (sigma <= 0.0) {
            throw new IllegalArgumentException("Invalid sigma: " + sigma);
        }
        this.mu = mu;
        this.sigma = sigma;

        mean = Math.exp(mu + sigma * sigma / 2);
        variance = (Math.exp(mu * mu) - 1) * Math.exp(2 * mu + sigma * sigma);
        entropy = 0.5 + 0.5 * Math.log(2 * Math.PI * sigma * sigma) + mu;
    }
@Test
    public void testLogNormalDistribution() {
        System.out.println("LogNormalDistribution");
        MathEx.setSeed(19650218); // to get repeatable results.
        LogNormalDistribution instance = new LogNormalDistribution(3, 2.1);
        double[] data = instance.rand(1000);
        LogNormalDistribution est = LogNormalDistribution.fit(data);
        assertEquals(3.04, est.mu, 1E-2);
        assertEquals(2.12, est.sigma, 1E-2);
    }