Examples of nextInt()


Examples of edu.brown.rand.RandomDistribution.Zipf.nextInt()

            Zipf randomNumItems = new Zipf(profile.rng,
                                           AuctionMarkConstants.ITEM_MIN_ITEMS_PER_SELLER,
                                           Math.round(AuctionMarkConstants.ITEM_MAX_ITEMS_PER_SELLER * profile.getScaleFactor()),
                                           1.001);
            for (long i = 0; i < this.tableSize; i++) {
                long num_items = randomNumItems.nextInt();
                profile.users_per_item_count.put(num_items);
            } // FOR
            if (trace.val)
                LOG.trace("Users Per Item Count:\n" + profile.users_per_item_count);
            this.idGenerator = new UserIdGenerator(profile.users_per_item_count, getNumClients());
View Full Code Here

Examples of edu.ucla.sspace.util.primitive.IntIterator.nextInt()

  }

        IntIterator iter = selected.iterator();
        DoubleVector[] centroids = new DoubleVector[k];
        for (int i = 0; iter.hasNext(); ++i)
            centroids[i] = dataPoints.getRowVector(iter.nextInt());
        return centroids;
    }

   
    private static IntPair pickFirstTwo(Matrix dataPoints,
View Full Code Here

Examples of freenet.crypt.DummyRandomSource.nextInt()

        // Now add some random links
        for(int i=0;i<NUMBER_OF_NODES*5;i++) {
            if(i % NUMBER_OF_NODES == 0)
                Logger.normal(RealNodeRoutingTest.class, String.valueOf(i));
            int length = (int)Math.pow(NUMBER_OF_NODES, random.nextDouble());
            int nodeA = random.nextInt(NUMBER_OF_NODES);
            int nodeB = (nodeA+length)%NUMBER_OF_NODES;
            //System.out.println(""+nodeA+" -> "+nodeB);
            Node a = nodes[nodeA];
            Node b = nodes[nodeB];
            a.connect(b, trust, visibility);
View Full Code Here

Examples of freenet.crypt.RandomSource.nextInt()

            if(i == storage.segments.length-1 && cmode.ordinal() < CompatibilityMode.COMPAT_1255.ordinal())
                fetched[inserterSegment.dataBlockCount-1] = true; // We don't use the last block of the last segment for old splitfiles
            for(int j=0;j<minBlocks;j++) {
                int blockNo;
                do {
                    blockNo = r.nextInt(totalBlocks);
                } while (fetched[blockNo]);
                fetched[blockNo] = true;
                ClientCHKBlock block = inserterSegment.encodeBlock(blockNo);
                assertFalse(fetcherSegment.hasStartedDecode());
                boolean success = fetcherSegment.onGotKey(block.getClientKey().getNodeCHK(), block.getBlock());
View Full Code Here

Examples of freenet.support.math.MersenneTwister.nextInt()

  }
 
  public void testEncodeDecodeRandomLength() throws CHKEncodeException, CHKVerifyException, CHKDecodeException, UnsupportedEncodingException, InvalidCompressionCodecException, IOException
    MersenneTwister random = new MersenneTwister(42);
    for(int i=0;i<10;i++) {
      byte[] buf = new byte[random.nextInt(CHKBlock.DATA_LENGTH+1)];
      random.nextBytes(buf);
      checkBlock(buf, false);
      checkBlock(buf, true);
    }
  }
View Full Code Here

Examples of gnu.trove.iterator.TIntDoubleIterator.nextInt()

           
        }
        else {
            IntIterator iter = vertices.iterator();
            while (iter.hasNext()) {
                int v = iter.nextInt();
                if (edges.containsKey(v))
                    copy.edges.put(v, edges.get(v));
            }
        }
        return copy;
View Full Code Here

Examples of gnu.trove.iterator.TIntIterator.nextInt()

            }           
        }
        else {
            IntIterator iter = vertices.iterator();
            while (iter.hasNext()) {
                int v = iter.nextInt();
                if (edges.contains(v))
                    copy.edges.add(v);
            }
        }
        return copy;
View Full Code Here

Examples of it.unimi.dsi.fastutil.ints.IntIterator.nextInt()

    for( int i = 0; i < numIndices; i++ ) {
      final IntIterator sizes = sizes( i );
      int s = 0;
      int j = index[ i ].numberOfDocuments;
      while( j-- != 0 ) {
        maxDocSize = Math.max( maxDocSize, s = sizes.nextInt() );
        if ( needsSizes ) size[ currDoc++ ] = s;
        sizesOutputBitStream.writeGamma( s );
      }
      if ( sizes instanceof Closeable ) ((Closeable)sizes).close();
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.ints.IntListIterator.nextInt()

            /* no-op */
        }
        IntListIterator iter = list.iterator();
        assertTrue(iter.hasNext());
        assertFalse(iter.hasPrevious());
        assertEquals(0, iter.nextInt());
        assertFalse(iter.hasNext());
        assertTrue(iter.hasPrevious());
        assertEquals(0, iter.previousInt());
    }

View Full Code Here

Examples of java.security.SecureRandom.nextInt()

    }

    private static void testLoop() throws Exception {
        Random random = new SecureRandom();
        while (true) {
            runOneTest(random.nextInt());
        }
    }

    private static Connection openConnection() throws Exception {
        Class.forName(DRIVER);
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.