Codota Logo
MersenneTwister.<init>
Code IndexAdd Codota to your IDE (free)

How to use
org.apache.commons.math3.random.MersenneTwister
constructor

Best Java code snippets using org.apache.commons.math3.random.MersenneTwister.<init> (Showing top 20 results out of 369)

  • Common ways to obtain MersenneTwister
private void myMethod () {
MersenneTwister m =
  • Codota Iconnew MersenneTwister()
  • Codota Iconnew MersenneTwister(seed)
  • Smart code suggestions by Codota
}
origin: org.apache.commons/commons-math3

/**
 * Create an object that will use a default RNG ({@link MersenneTwister}),
 * in order to generate the individual components.
 *
 * @param dimension Space dimension.
 */
public UnitSphereRandomVectorGenerator(final int dimension) {
  this(dimension, new MersenneTwister());
}
origin: apache/mahout

RandomWrapper(long seed) {
 random = new MersenneTwister(seed);
}
origin: apache/flink

  @Override
  public MersenneTwister generator() {
    MersenneTwister random = new MersenneTwister();
    random.setSeed(seed);
    return random;
  }
}
origin: deeplearning4j/nd4j

public DefaultRandom(long seed) {
  this.seed = seed;
  this.randomGenerator = new SynchronizedRandomGenerator(new MersenneTwister(seed));
}
origin: apache/mahout

RandomWrapper() {
 random = new MersenneTwister();
 random.setSeed(System.currentTimeMillis() + System.identityHashCode(random));
}
origin: opentripplanner/OpenTripPlanner

  public static void main (String... args) {
    System.out.println("Testing histogram store with normal distribution, mean 0");
    Histogram h = new Histogram("Normal");

    MersenneTwister mt = new MersenneTwister();

    IntStream.range(0, 1000000).map(i -> (int) Math.round(mt.nextGaussian() * 20 + 2.5)).forEach(h::add);

    h.displayHorizontal();
    System.out.println("mean: " + h.mean());
  }
}
origin: apache/hbase

return new Iterator<List<HStoreFile>>() {
 private GaussianRandomGenerator gen =
   new GaussianRandomGenerator(new MersenneTwister(random.nextInt()));
 private int count = 0;
origin: linkedin/cruise-control

/**
 * Test if two clusters are significantly different in the metrics we look at for balancing.
 *
 * @param orig the utilization matrix from the original cluster
 * @param optimized the utilization matrix from the optimized cluster
 * @return The P value that the various derived resources come from the same probability distribution.  The probability
 * that the null hypothesis is correct.
 */
public static double[] testDifference(double[][] orig, double[][] optimized) {
 int nResources = RawAndDerivedResource.values().length;
 if (orig.length != nResources) {
  throw new IllegalArgumentException("orig must have number of rows equal to RawAndDerivedResource.");
 }
 if (optimized.length != nResources) {
  throw new IllegalArgumentException("optimized must have number of rows equal to RawAndDerivedResource.");
 }
 if (orig[0].length != optimized[0].length) {
  throw new IllegalArgumentException("The number of brokers must be the same.");
 }
 double[] pValues = new double[orig.length];
 //TODO:  For small N we want to do statistical bootstrapping (not the same as bootstrapping data).
 for (int resourceIndex = 0; resourceIndex < nResources; resourceIndex++) {
  RandomGenerator rng = new MersenneTwister(0x5d11121018463324L);
  KolmogorovSmirnovTest kolmogorovSmirnovTest = new KolmogorovSmirnovTest(rng);
  pValues[resourceIndex] =
    kolmogorovSmirnovTest.kolmogorovSmirnovTest(orig[resourceIndex], optimized[resourceIndex]);
 }
 return pValues;
}
origin: kiegroup/optaplanner

@Override
public Random createRandom() {
  switch (randomType) {
    case JDK:
      return randomSeed == null ? new Random() : new Random(randomSeed);
    case MERSENNE_TWISTER:
      return new RandomAdaptor(randomSeed == null ? new MersenneTwister() : new MersenneTwister(randomSeed));
    case WELL512A:
      return new RandomAdaptor(randomSeed == null ? new Well512a() : new Well512a(randomSeed));
    case WELL1024A:
      return new RandomAdaptor(randomSeed == null ? new Well1024a() : new Well1024a(randomSeed));
    case WELL19937A:
      return new RandomAdaptor(randomSeed == null ? new Well19937a() : new Well19937a(randomSeed));
    case WELL19937C:
      return new RandomAdaptor(randomSeed == null ? new Well19937c() : new Well19937c(randomSeed));
    case WELL44497A:
      return new RandomAdaptor(randomSeed == null ? new Well44497a() : new Well44497a(randomSeed));
    case WELL44497B:
      return new RandomAdaptor(randomSeed == null ? new Well44497b() : new Well44497b(randomSeed));
    default:
      throw new IllegalStateException("The randomType (" + randomType + ") is not implemented.");
  }
}
origin: jMetal/jMetal

/** Constructor */
public MersenneTwisterGenerator(long seed) {
 this.seed = seed ;
 rnd = new MersenneTwister(seed) ;
}
origin: io.virtdata/virtdata-lib-realer

/**
 * Create an object that will use a default RNG ({@link MersenneTwister}),
 * in order to generate the individual components.
 *
 * @param dimension Space dimension.
 */
public UnitSphereRandomVectorGenerator(final int dimension) {
  this(dimension, new MersenneTwister());
}
origin: geogebra/geogebra

/**
 * Create an object that will use a default RNG ({@link MersenneTwister}),
 * in order to generate the individual components.
 *
 * @param dimension Space dimension.
 */
public UnitSphereRandomVectorGenerator(final int dimension) {
  this(dimension, new MersenneTwister());
}
origin: io.virtdata/virtdata-lib-random

public RandomRangedToString(long min, long max, long seed) {
  this.theTwister = new MersenneTwister(seed);
  if (max<=min) {
    throw new RuntimeException("max must be >= min");
  }
  this.min = min;
  this.max = max;
  this._length = max - min;
}
origin: com.github.rinde/rinsim-problem

 @Override
 public Solver get(long seed) {
  return new RandomSolver(new MersenneTwister(seed));
 }
};
origin: com.github.rinde/rinlog

/**
 * Creates a random route planner using the specified random seed.
 * @param seed The random seed.
 */
public RandomRoutePlanner(long seed) {
 LOGGER.info("constructor {}", seed);
 assignedParcels = LinkedHashMultiset.create();
 current = Optional.absent();
 rng = new RandomAdaptor(new MersenneTwister(seed));
}
origin: io.virtdata/virtdata-lib-random

public RandomLineToString(String filename, long seed) {
  this.rng = new MersenneTwister(seed);
  this.filename = filename;
  this.lines = ResourceFinder.readDataFileLines(filename);
  itemDistribution= new UniformIntegerDistribution(rng, 0, lines.size()-2);
}
origin: io.virtdata/virtdata-lib-random

public RandomLineToStringMap(String paramFile, int maxSize) {
  rng = new MersenneTwister(System.nanoTime());
  this.sizeDistribution = new UniformIntegerDistribution(rng, 0,maxSize-1);
  this.lineDataMapper = new RandomLineToString(paramFile);
}
origin: io.virtdata/virtdata-lib-random

public RandomLineToStringMap(String paramFile, int maxSize, long seed) {
  this.rng = new MersenneTwister(seed);
  this.sizeDistribution = new UniformIntegerDistribution(rng, 0,maxSize-1);
  this.lineDataMapper = new RandomLineToString(paramFile);
}
origin: io.virtdata/virtdata-lib-random

public RandomFileExtractToString(String fileName, int minsize, int maxsize, long seed) {
  this.fileName = fileName;
  this.minsize = minsize;
  this.maxsize = maxsize;
  loadData();
  this.rng = new MersenneTwister(seed);
  this.sizeDistribution = new UniformIntegerDistribution(rng, minsize, maxsize);
  this.positionDistribution = new UniformIntegerDistribution(rng, 1, fileDataImage.limit() - maxsize);
}
origin: rinde/RinSim

@Override
public void setSolverProvider(SimSolverBuilder provider) {
 solver =
  Optional.of(provider.setVehicles(new LinkedHashSet<>(asList(this)))
   .build(new RandomSolver(new MersenneTwister(123))));
}
org.apache.commons.math3.randomMersenneTwister<init>

Javadoc

Creates a new random number generator.

The instance is initialized using the current time plus the system identity hash code of this instance as the seed.

Popular methods of MersenneTwister

  • setSeed
    Reinitialize the generator as if just built with the given int array seed.The state of the generator
  • nextInt
  • nextDouble
  • nextLong
  • clear
  • nextGaussian
  • nextBytes
  • nextBoolean

Popular in Java

  • Start an intent from android
  • onRequestPermissionsResult (Fragment)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now