Examples of MersenneTwister


Examples of org.apache.commons.math3.random.MersenneTwister

    }

    @Before
    public void setUp() {
        generator = createConvexHullGenerator(false);
        random = new MersenneTwister(10);
    }
View Full Code Here

Examples of org.apache.commons.math3.random.MersenneTwister

*  - allow editing of the point set
*/
public class GeometryExample {

    public static List<Vector2D> createRandomPoints(int size) {
        RandomGenerator random = new MersenneTwister();

        // create the cloud container
        List<Vector2D> points = new ArrayList<Vector2D>(size);
        // fill the cloud with a random distribution of points
        for (int i = 0; i < size; i++) {
            points.add(new Vector2D(FastMath.round(random.nextDouble() * 400 + 100),
                    FastMath.round(random.nextDouble() * 400 + 100)));
        }
       
        return points;
    }
View Full Code Here

Examples of org.apache.commons.math3.random.MersenneTwister

                                   new GammaDistribution(5, 1),
                                   new GammaDistribution(9, 0.5));
            container.add(comp, c);

            c.gridx++;
            RandomGenerator rng = new MersenneTwister(0);
            comp = createComponent("Levy", 0, 3,
                                   new String[] { "c=0.5", "c=1", "c=2", "c=4", "c=8" },
                                   new LevyDistribution(rng, 0, 0.5),
                                   new LevyDistribution(rng, 0, 1),
                                   new LevyDistribution(rng, 0, 2),
View Full Code Here

Examples of org.apache.commons.math3.random.MersenneTwister

            generators.add(new Pair<String, RandomVectorGenerator>("Uncorrelated\nUniform(JDK)",
                    new UncorrelatedRandomVectorGenerator(2, new UniformRandomGenerator(new JDKRandomGenerator()))));
            generators.add(new Pair<String, RandomVectorGenerator>("Independent\nRandom(MT)", new RandomVectorGenerator() {

                RandomGenerator[] rngs = new RandomGenerator[] {
                    new MersenneTwister(0),
                    new MersenneTwister(1)
                };
               
                public double[] nextVector() {
                    final double[] vector = new double[2];
                    vector[0] = rngs[0].nextDouble();
View Full Code Here

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

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

  /**
   * 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

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

      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

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

      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

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

      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

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

   * 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
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.