public PoissonDistribution(double lambda) {
        if (lambda < 0.0) {
            throw new IllegalArgumentException("Invalid lambda: " + lambda);
        }

        this.lambda = lambda;
        entropy = (Math.log(2 * Math.PI * Math.E) + Math.log(lambda)) / 2 - 1 / (12 * lambda) - 1 / (24 * lambda * lambda) - 19 / (360 * lambda * lambda * lambda);
    }
@Test
    public void testPoissonDistribution() {
        System.out.println("PoissonDistribution");
        MathEx.setSeed(19650218); // to get repeatable results.
        PoissonDistribution instance = new PoissonDistribution(5.5);
        int[] data = instance.randi(1000);
        PoissonDistribution est = PoissonDistribution.fit(data);
        assertEquals(5.52, est.lambda, 1E-2);
    }