Example usage for org.apache.commons.math3.distribution ZipfDistribution ZipfDistribution

List of usage examples for org.apache.commons.math3.distribution ZipfDistribution ZipfDistribution

Introduction

In this page you can find the example usage for org.apache.commons.math3.distribution ZipfDistribution ZipfDistribution.

Prototype

public ZipfDistribution(RandomGenerator rng, int numberOfElements, double exponent)
        throws NotStrictlyPositiveException 

Source Link

Document

Creates a Zipf distribution.

Usage

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);
}