Chi2 implements IContinuousDistribution { @Deprecated public Chi2() { df_ = 2; fillHelpers(); } @Deprecated  Chi2();  Chi2(final int df); int getDegreesofFreedom(); @Override double getDensity(final double x); @Override String getDescription(); @Override double getExpectation(); @Override double getLeftBound(); @Override double getProbability(final double x, final ProbabilityType pt); @Override double getProbabilityInverse(double p, final ProbabilityType pt); @Override double getRightBound(); @Override double getVariance(); @Override BoundaryType hasLeftBound(); @Override BoundaryType hasRightBound(); @Override boolean isSymmetrical(); @Override /** * REFERENCE : - J.F. Monahan (1987): An algorithm for * generating chi * random variables, ACM Trans. * Math. Software 13, 168-172. * Based on "cern.jet.random.ChiSquare", from the Colt library * Copyright (c) 1999 CERN - European Organization for Nuclear Research. */ double random(IRandomNumberGenerator rng); @Deprecated void setDegreesofFreedom(final int df); @Override String toString(); static final String NAME; }
@Test @Ignore public void testRandomsOld() { double s = 0; int N = 1000000; long t0 = System.currentTimeMillis(); MersenneTwister rng = MersenneTwister.fromSystemNanoTime(); for (int i = 0; i < N; ++i) { s += StochasticRandomizer.chi2(rng, 20); } long t1 = System.currentTimeMillis(); System.out.println("Old"); System.out.println(t1 - t0); System.out.println(s / N); }