Examples of nextDouble()


Examples of org.apache.commons.math3.random.Well1024a.nextDouble()

        // we compare accurate versus naive dot product implementations
        // on regular vectors (i.e. not extreme cases like in the previous test)
        Well1024a random = new Well1024a(553267312521321234l);

        for (int i = 0; i < 10000; ++i) {
            final double ux = 1e17 * random.nextDouble();
            final double uy = 1e17 * random.nextDouble();
            final double uz = 1e17 * random.nextDouble();
            final double vx = 1e17 * random.nextDouble();
            final double vy = 1e17 * random.nextDouble();
            final double vz = 1e17 * random.nextDouble();
 
View Full Code Here

Examples of org.apache.commons.math3.random.Well19937a.nextDouble()

        }

        // verify old events are preserved, even if randomly accessed
        RandomGenerator rng = new Well19937a(0xb0e7401265af8cd3l);
        for (int i = 0; i < 5000; i++) {
            double t = t0 + (t1 - t0) * rng.nextDouble();
            double g = eventFilter.g(t, new double[] { FastMath.sin(t), FastMath.cos(t) });
            int turn = (int) FastMath.floor((t - refSwitch) / (2 * FastMath.PI));
            if (turn % 2 == 0) {
                Assert.assertEquals( signEven * FastMath.sin(t), g, 1.0e-10);
            } else {
View Full Code Here

Examples of org.apache.mahout.common.RandomWrapper.nextDouble()

  public void testTrainingTestingSets() throws IOException {
    int n = 20;

    for (int nloop = 0; nloop < n; nloop++) {
      RandomWrapper rng = (RandomWrapper) RandomUtils.getRandom();
      double threshold = rng.nextDouble();

      JobConf conf = new JobConf();
      Set<Long> dataset = new HashSet<Long>();
      LongWritable key = new LongWritable();
      Text value = new Text();
View Full Code Here

Examples of org.apache.mahout.math.jet.random.AbstractContinousDistribution.nextDouble()

        TDigest dist = new TDigest((double) 1000, gen);
        long t0 = System.nanoTime();
        List<Double> data = Lists.newArrayList();
        for (int i1 = 0; i1 < 100000; i1++) {
            double x = mix.nextDouble();
            data.add(x);
            dist.add(x);
        }

        System.out.printf("# %fus per point\n", (System.nanoTime() - t0) * 1e-3 / 100000);
View Full Code Here

Examples of org.apache.mahout.math.jet.random.Exponential.nextDouble()

        double t = 0;
        long t0 = System.nanoTime();
        long messageId = 0;
        while (messageId < options.max) {
            double rate = options.peak * Math.exp(-scale * (Math.cos(2 * Math.PI * t / options.period) + 1));
            double dt = interval.nextDouble() / rate;
            t += dt;
            double now = (System.nanoTime() - t0) / 1e9;
            if (t > now + 0.01) {
                double millis = Math.floor((t - now) * 1000);
                double nanos = Math.rint((t - now) * 1e9 - millis * 1e6);
 
View Full Code Here

Examples of org.apache.mahout.math.jet.random.Gamma.nextDouble()

  private static OnlineSummarizer gamma(int n, double shape) {
    OnlineSummarizer x = new OnlineSummarizer();
    Random gen = RandomUtils.getRandom();
    AbstractContinousDistribution gamma = new Gamma(shape, shape, gen);
    for (int i = 0; i < n; i++) {
      x.add(gamma.nextDouble());
    }
    return x;
  }

}
View Full Code Here

Examples of org.apache.mahout.math.jet.random.Normal.nextDouble()

    for (int i=0;i<100000;i++) {
      double score = n0.nextDouble();
      double p = n1.pdf(score) / (n0.pdf(score) + n1.pdf(score));
      auc.add(0, p);

      score = n1.nextDouble();
      p = n1.pdf(score) / (n0.pdf(score) + n1.pdf(score));
      auc.add(1, p);
    }
    Matrix m = auc.entropy();
    assertEquals(-0.35, m.get(0, 0), 0.02);
View Full Code Here

Examples of org.apache.mahout.math.jet.random.Uniform.nextDouble()

            @Override
            public double nextDouble() {
                double x;
                if (gen.nextDouble() < 0.5) {
                    x = uniform.nextDouble();
                } else {
                    x = normal.nextDouble();
                }
                return x;
            }
View Full Code Here

Examples of org.encog.mathutil.randomize.ConsistentRandomizer.nextDouble()

     * {@inheritDoc}
     */
    performConnectionTask(new ConnectionTask() {
      @Override
      public void task(final FreeformConnection connection) {
        connection.setWeight(randomizer.nextDouble());
      }
    });
  }

  /**
 
View Full Code Here

Examples of org.encog.mathutil.randomize.generate.LinearCongruentialRandom.nextDouble()

    final BasicMLDataSet result = new BasicMLDataSet();
    for (int i = 0; i < count; i++) {
      final MLData inputData = new BasicMLData(inputCount);

      for (int j = 0; j < inputCount; j++) {
        inputData.setData(j, rand.nextDouble(min, max));
      }

      final MLData idealData = new BasicMLData(idealCount);

      for (int j = 0; j < idealCount; j++) {
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.