public ExponentialDistribution(double lambda) {
        if (lambda <= 0) {
            throw new IllegalArgumentException("Invalid lambda: " + lambda);
        }

        this.lambda = lambda;
    }
@Test
    public void testExponentialDistribution() {
        System.out.println("ExponentialDistribution");
        MathEx.setSeed(19650218); // to get repeatable results.
        ExponentialDistribution instance = new ExponentialDistribution(3);
        double[] data = instance.rand(1000);
        ExponentialDistribution est = ExponentialDistribution.fit(data);
        assertEquals(3.08, est.lambda, 1E-2);
    }