### Question:
GeneralizedParetoDistribution implements ProbabilityDistribution<Double> { @Override public double nextRandom() { return _mu + _sigma * (Math.pow(_engine.nextDouble(), -_ksi) - 1) / _ksi; } GeneralizedParetoDistribution(double mu, double sigma, double ksi);  GeneralizedParetoDistribution(double mu, double sigma, double ksi, RandomEngine engine); double getMu(); double getSigma(); double getKsi(); @Override double getCDF(Double x); @Override double getInverseCDF(Double p); @Override double getPDF(Double x); @Override double nextRandom(); @Override int hashCode(); @Override boolean equals(Object obj);  }### Answer:
@Test public void testDistribution() { final Function<double[], Double> meanCalculator = new MeanCalculator(); final Function<double[], Double> medianCalculator = new MedianCalculator(); final Function<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)); assertThat(meanCalculator.apply(data)).isCloseTo(mean, offset(eps)); assertThat(medianCalculator.apply(data)).isCloseTo(median, offset(eps)); assertThat(varianceCalculator.apply(data)).isCloseTo(variance, offset(eps)); }