GeneralizedParetoDistribution implements ProbabilityDistribution<Double> { @Override public double nextRandom() { return _mu + _sigma * (Math.pow(_engine.nextDouble(), -_ksi) - 1) / _ksi; } GeneralizedParetoDistribution(final double mu, final double sigma, final double ksi);  GeneralizedParetoDistribution(final double mu, final double sigma, final double ksi, final RandomEngine engine); double getMu(); double getSigma(); double getKsi(); @Override double getCDF(final Double x); @Override double getInverseCDF(final Double p); @Override double getPDF(final Double x); @Override double nextRandom(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testDistribution() { final Function1D<double[], Double> meanCalculator = new MeanCalculator(); final Function1D<double[], Double> medianCalculator = new MedianCalculator(); final Function1D<double[], Double> varianceCalculator = new PopulationVarianceCalculator(); final int n = 1000000; final double eps = 0.1; final double[] data = new double[n]; for (int i = 0; i < n; i++) { data[i] = DIST.nextRandom(); } final double mean = MU + SIGMA / (1 - KSI); final double median = MU + SIGMA * (Math.pow(2, KSI) - 1) / KSI; final double variance = SIGMA * SIGMA / ((1 - KSI) * (1 - KSI) * (1 - 2 * KSI)); assertEquals(meanCalculator.evaluate(data), mean, eps); assertEquals(medianCalculator.evaluate(data), median, eps); assertEquals(varianceCalculator.evaluate(data), variance, eps); }