Examples of nextDouble()


Examples of java.util.Random.nextDouble()

    String field="field"+precisionStep;
    // 10 random tests, the index order is ascending,
    // so using a reverse sort field should retun descending documents
    for (int i=0; i<10; i++) {
      int lower=(int)(rnd.nextDouble()*noDocs*distance)+startOffset;
      int upper=(int)(rnd.nextDouble()*noDocs*distance)+startOffset;
      if (lower>upper) {
        int a=lower; lower=upper; upper=a;
      }
      Query tq=NumericRangeQuery.newIntRange(field, precisionStep, lower, upper, true, true);
      TopDocs topDocs = searcher.search(tq, null, noDocs, new Sort(new SortField(field, SortField.INT, true)));
View Full Code Here

Examples of java.util.Scanner.nextDouble()

    for (i = 0; i < S.vals; i++) {
      x = scanner.nextInt();
      S.rowind[i] = x - 1;
    }
    for (i = 0; i < S.vals; i++) {
      S.value[i] = scanner.nextDouble();
    }
    return S;
  }

}
View Full Code Here

Examples of java.util.concurrent.ThreadLocalRandom.nextDouble()

        Set<MeasurementDataNumeric> data = new HashSet<MeasurementDataNumeric>(batchSize);
        long timestamp = dateTimeService.nowInMillis();
        ThreadLocalRandom random = ThreadLocalRandom.current();

        for (int i = 0; i < batchSize; ++i) {
            data.add(new MeasurementDataNumeric(timestamp, startingScheduleId + i, random.nextDouble()));
        }

        return data;
    }
View Full Code Here

Examples of jmt.engine.random.engine.MersenneTwister.nextDouble()

    for (i = 0; i < dimArray; i++) {
      rndArray[i] = i;
    }

    for (i = 0; i < numToRead; i++) {
      rndNum = (int) (mst.nextDouble() * dimArray);
      catchVal[rndArray[rndNum]] = true;
      if (max < rndArray[rndNum]) {
        max = rndArray[rndNum];
      }
      rndArray[rndNum] = rndArray[--dimArray];
View Full Code Here

Examples of org.apache.commons.math.random.JDKRandomGenerator.nextDouble()

        // Assume model has 16 observations (will use Longley data).  Start by generating
        // non-constant variances for the 16 error terms.
        final int nObs = 16;
        double[] sigma = new double[nObs];
        for (int i = 0; i < nObs; i++) {
            sigma[i] = 10 * rg.nextDouble();
        }
       
        // Now generate 1000 error vectors to use to estimate the covariance matrix
        // Columns are draws on N(0, sigma[col])
        final int numSeeds = 1000;
View Full Code Here

Examples of org.apache.commons.math.random.RandomGenerator.nextDouble()

        while (nextGeneration.getPopulationSize() < nextGeneration.getPopulationLimit()) {
            // select parent chromosomes
            ChromosomePair pair = getSelectionPolicy().select(current);

            // crossover?
            if (randGen.nextDouble() < getCrossoverRate()) {
                // apply crossover policy to create two offspring
                pair = getCrossoverPolicy().crossover(pair.getFirst(), pair.getSecond());
            }

            // mutation?
View Full Code Here

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

        final ISAACRandom rand = new ISAACRandom(10L);// Seed can be changed
        final SimpleRegression whole = new SimpleRegression(includeIntercept);// regression of the whole set
        final SimpleRegression parts = new SimpleRegression(includeIntercept);// regression with parts.

        for (int s = 0; s < sets; s++) {// loop through each subset of data.
            final double coef = rand.nextDouble();
            final SimpleRegression sub = new SimpleRegression(includeIntercept);// sub regression
            for (int i = 0; i < 5; i++) { // loop through individual samlpes.
                final double x = rand.nextDouble();
                final double y = x * coef + rand.nextDouble();// some noise
                sub.addData(x, y);
View Full Code Here

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

        // Assume model has 16 observations (will use Longley data).  Start by generating
        // non-constant variances for the 16 error terms.
        final int nObs = 16;
        double[] sigma = new double[nObs];
        for (int i = 0; i < nObs; i++) {
            sigma[i] = 10 * rg.nextDouble();
        }
       
        // Now generate 1000 error vectors to use to estimate the covariance matrix
        // Columns are draws on N(0, sigma[col])
        final int numSeeds = 1000;
View Full Code Here

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

        // 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.RandomGenerator.nextDouble()

        final RandomGenerator random = GeneticAlgorithm.getRandomGenerator();

        for (int index = 0; index < length; index++) {

            if (random.nextDouble() < ratio) {
                // swap the bits -> take other parent
                child1Rep.add(parent2Rep.get(index));
                child2Rep.add(parent1Rep.get(index));
            } else {
                child1Rep.add(parent1Rep.get(index));
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.