Package org.apache.mahout.math.jet.random.engine

Examples of org.apache.mahout.math.jet.random.engine.MersenneTwister


      // Simply make a list (0,1,..N-1) and randomize it, seeded with "p".
      // Note that this is perhaps not what you want...
      for (int i = N; --i >= 0;) {
        permutation[i] = i;
      }
      Uniform gen = new Uniform(new MersenneTwister((int) p));
      for (int i = 0; i < N - 1; i++) {
        int random = gen.nextIntFromTo(i, N - 1);

        //swap(i, random)
        int tmp = permutation[random];
View Full Code Here


  /**
   * Constructs a uniform distribution with the given minimum and maximum, using a {@link
   * org.apache.mahout.math.jet.random.engine.MersenneTwister} seeded with the given seed.
   */
  public Uniform(double min, double max, int seed) {
    this(min, max, new MersenneTwister(seed));
  }
View Full Code Here

      fraction = 1;
    }

    // random generator seeded with current time
    if (randomGenerator == null) {
      randomGenerator = new MersenneTwister((int) System.currentTimeMillis());
    }

    int ncols = (int) Math.round(matrix.size() * fraction);
    int max = ncols;
    long[] selected = new long[max]; // sampler works on long's, not int's
View Full Code Here

      columnFraction = 1;
    }

    // random generator seeded with current time
    if (randomGenerator == null) {
      randomGenerator = new MersenneTwister((int) System.currentTimeMillis());
    }

    int nrows = (int) Math.round(matrix.rows() * rowFraction);
    int ncols = (int) Math.round(matrix.columns() * columnFraction);
    int max = Math.max(nrows, ncols);
View Full Code Here

      columnFraction = 1;
    }

    // random generator seeded with current time
    if (randomGenerator == null) {
      randomGenerator = new MersenneTwister((int) System.currentTimeMillis());
    }

    int nslices = (int) Math.round(matrix.slices() * sliceFraction);
    int nrows = (int) Math.round(matrix.rows() * rowFraction);
    int ncols = (int) Math.round(matrix.columns() * columnFraction);
 
View Full Code Here

   * org.apache.mahout.math.jet.random.AbstractDistribution} are function objects, because they implement the proper
   * interfaces. Thus, if you are not happy with the default, just pass your favourite random generator to function
   * evaluating methods.
   */
  public static UnaryFunction random() {
    return new MersenneTwister(new Date());
  }
View Full Code Here

   * org.apache.mahout.math.jet.random.AbstractDistribution} are function objects, because they implement the proper
   * interfaces. Thus, if you are not happy with the default, just pass your favourite random generator to function
   * evaluating methods.
   */
  public static IntFunction random() {
    return new MersenneTwister(new Date());
  }
View Full Code Here

      return matrix;
    }

    RandomSamplingAssistant sampler =
        new RandomSamplingAssistant(n, size,
            new MersenneTwister());
    for (int i = 0; i < size; i++) {
      if (sampler.sampleNextElement()) {
        int row = i / columns;
        int column = i % columns;
        matrix.set(row, column, value);
View Full Code Here

      return matrix;
    }

    RandomSamplingAssistant sampler =
        new RandomSamplingAssistant(n, size,
            new MersenneTwister());
    for (int i = size; --i >= 0;) {
      if (sampler.sampleNextElement()) {
        matrix.set(i, value);
      }
    }
View Full Code Here

   * org.apache.mahout.math.jet.random.AbstractDistribution} are function objects, because they implement the proper
   * interfaces. Thus, if you are not happy with the default, just pass your favourite random generator to function
   * evaluating methods.
   */
  public static DoubleFunction random() {
    return new MersenneTwister(new Date());
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.math.jet.random.engine.MersenneTwister

Copyright © 2018 www.massapicom. 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.