List of usage examples for org.apache.commons.math3.distribution ZipfDistribution ZipfDistribution
public ZipfDistribution(RandomGenerator rng, int numberOfElements, double exponent) throws NotStrictlyPositiveException
From source file:io.coala.random.impl.RandomDistributionFactoryImpl.java
@Override public RandomNumberDistribution<Integer> getZipf(final RandomNumberStream rng, final Number numberOfElements, final Number exponent) { final IntegerDistribution dist = new ZipfDistribution(RandomNumberStream.Util.asCommonsRandomGenerator(rng), numberOfElements.intValue(), exponent.doubleValue()); return new RandomNumberDistribution<Integer>() { @Override/* www . j a v a 2s . co m*/ public Integer draw() { return dist.sample(); } }; }
From source file:org.apache.accumulo.core.file.rfile.RolllingStatsTest.java
@Test public void testZipf() { ZipfDistribution zd = new ZipfDistribution(new Well19937c(42), 1000, 2); testDistribrution(() -> zd.sample() * 100); }