Examples of nextInt()


Examples of org.apache.commons.math3.random.RandomGenerator.nextInt()

        int remainingPoints = crossoverPoints;
        int lastIndex = 0;
        for (int i = 0; i < crossoverPoints; i++, remainingPoints--) {
            // select the next crossover point at random
            final int crossoverIndex = 1 + lastIndex + random.nextInt(length - lastIndex - remainingPoints);

            // copy the current segment
            for (int j = lastIndex; j < crossoverIndex; j++) {
                c1.add(parent1Rep.get(j));
                c2.add(parent2Rep.get(j));
View Full Code Here

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

    @Test
    public void testFloorDivModInt() {
        RandomGenerator generator = new Well1024a(0x7ccab45edeaab90al);
        for (int i = 0; i < 10000; ++i) {
            int a = generator.nextInt();
            int b = generator.nextInt();
            if (b == 0) {
                try {
                    FastMath.floorDiv(a, b);
                    Assert.fail("an exception should have been thrown");
View Full Code Here

Examples of org.apache.commons.math3.random.Well19937c.nextInt()

            }

            /** {@inheritDoc} */
            public double[] next() {
                ++n;
                return points[rng.nextInt(points.length)].toArray();
            }

            /** {@inheritDoc} */
            public void remove() {
                throw new MathUnsupportedOperationException();
View Full Code Here

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

  protected void shufflePreferences() {
    RandomWrapper random = RandomUtils.getRandom();
    /* Durstenfeld shuffle */
    for (int currentPos = cachedUserIDs.length - 1; currentPos > 0; currentPos--) {
      int swapPos = random.nextInt(currentPos + 1);
      swapCachedPreferences(currentPos, swapPos);
    }
  }

  private void swapCachedPreferences(int posA, int posB) {
View Full Code Here

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

    SequenceFile.Writer writer = new SequenceFile.Writer(fs, conf, input, IntWritable.class,
            DoubleWritable.class);
    Random random = RandomUtils.getRandom();
    Normal normal = new Normal(5, 3, random);
    for (int i = 0; i < 1000000; i++) {
      writer.append(new IntWritable(i), new DoubleWritable((long) normal.nextInt()));
    }
    writer.close();
    double v = BasicStats.stdDev(input, output, conf);
    assertEquals(3, v, 0.02);
  }
View Full Code Here

Examples of org.apache.mahout.math.jet.random.Poisson.nextInt()

      // we sample every 5-15 seconds
      double dt = gen.nextDouble() * 10 + 5;
      t[i] = lastT + dt;

      // at those points, we get a Poisson count
      k[i] = p.nextInt(dt * 0.2);
      lastT = t[i];
    }

    OnlineExponentialAverage averager = new OnlineExponentialAverage(2000);

View Full Code Here

Examples of org.eclipse.jgit.junit.TestRng.nextInt()

    try {
      int written = 0;
      boolean onebyte = true;
      while (written < max) {
        if (onebyte) {
          final byte v = (byte) rng.nextInt();
          b.write(v);
          expect[written++] = v;
        } else {
          final int len = Math
              .min(rng.nextInt() & 127, max - written);
View Full Code Here

Examples of org.hsqldb.lib.Iterator.nextInt()

        dbProps          = new HsqlProperties[dbAlias.length];

        Iterator it = dbNumberMap.keySet().iterator();

        for (int i = 0; it.hasNext(); ) {
            int    dbNumber = it.nextInt();
            String path     = getDatabasePath(dbNumber, true);

            if (path == null) {
                printWithThread("missing database path: "
                                + dbNumberMap.get(dbNumber));
View Full Code Here

Examples of org.hsqldb_voltpatches.lib.Iterator.nextInt()

            lookup.setKeysSearchTarget();

            Iterator it = this.rowActionMap.keySet().iterator();

            for (; it.hasNext(); ) {
                lookup.addUnique(it.nextInt(), 0);
            }

            return lookup;
        } finally {
            writeLock.unlock();
View Full Code Here

Examples of org.jamesii.core.math.random.generators.IRandom.nextInt()

          break;
        }

        // ok, we have possible partners, lets make an edge
        // pick one randomly
        int partnerIndex = rnd.nextInt(possibleNeighbourIndices.size());
        graph.addEdge(new AnnotatedEdge<>(nodeList.get(i), nodeList
            .get(possibleNeighbourIndices.get(partnerIndex)), elDistri
            .getRandomNumber()));

        // update degrees
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.