Package benchmark.generator

Source Code of benchmark.generator.ParetoDistGenerator

package benchmark.generator;

import umontreal.iro.lecuyer.probdist.ParetoDist;

public class ParetoDistGenerator {
  private ParetoDist pareto;
  private int max;

  public ParetoDistGenerator(double alpha, int maxValue)
  {
    pareto   = new ParetoDist(alpha);
    max    = maxValue;
  }

  public int getValue()
  {
    int i;
    for(i=(int)pareto.inverseF(Math.random());i>max;i=(int)pareto.inverseF(Math.random()));
    return i;
  }
}
TOP

Related Classes of benchmark.generator.ParetoDistGenerator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.