Package java.util

Examples of java.util.Random.nextLong()


    while(true) {
      Thread.sleep(1000);
      GenericRecord params = new GenericData.Record(protocol.getMessages().get(
        "sleep").getRequest());
      Random rand = new Random();
      params.put("millis", Math.abs(rand.nextLong()) % 1000);
      int payloadSize = Math.abs(rand.nextInt()) % 10000;
      byte[] payload = new byte[payloadSize];
      rand.nextBytes(payload);
      params.put("data", ByteBuffer.wrap(payload));
      req.request("sleep", params);
View Full Code Here


        break;
      case 'I':
        result.add(r.nextInt());
        break;
      case 'L':
        result.add(r.nextLong());
        break;
      case 'F':
        result.add(r.nextFloat());
        break;
      case 'D':
View Full Code Here


      // increase number of iterations for more complete testing     
      for (int i=0; i<1000; i++) {
        int lev = rnd.nextInt(maxLev);
        final long seed = rnd.nextLong();
        BooleanQuery q1 = TestBoolean2.randBoolQuery(new Random(seed), true, lev, field, vals, null);
        // BooleanQuery q2 = TestBoolean2.randBoolQuery(new Random(seed), lev, field, vals, minNrCB);
        BooleanQuery q2 = TestBoolean2.randBoolQuery(new Random(seed), true, lev, field, vals, null);
        // only set minimumNumberShouldMatch on the top level query since setting
        // at a lower level can change the score.
View Full Code Here

    void genData(Encoder e) throws IOException {
      e.writeArrayStart();
      e.setItemCount((count / 4) *4);
      Random r = newRandom();
      for (int i = 0; i < count /4; i++) {
        e.writeLong(r.nextLong() % 0x7FL); // half fit in 1, half in 2
        e.writeLong(r.nextLong() % 0x1FFFFFL); // half fit in <=3, half in 4
        e.writeLong(r.nextLong() % 0x3FFFFFFFFL); // half in <=5, half in 6
        e.writeLong(r.nextLong() % 0x1FFFFFFFFFFFFL); // half in <=8, half in 9
      }
      e.writeArrayEnd();
View Full Code Here

      e.writeArrayStart();
      e.setItemCount((count / 4) *4);
      Random r = newRandom();
      for (int i = 0; i < count /4; i++) {
        e.writeLong(r.nextLong() % 0x7FL); // half fit in 1, half in 2
        e.writeLong(r.nextLong() % 0x1FFFFFL); // half fit in <=3, half in 4
        e.writeLong(r.nextLong() % 0x3FFFFFFFFL); // half in <=5, half in 6
        e.writeLong(r.nextLong() % 0x1FFFFFFFFFFFFL); // half in <=8, half in 9
      }
      e.writeArrayEnd();
    }
View Full Code Here

      e.setItemCount((count / 4) *4);
      Random r = newRandom();
      for (int i = 0; i < count /4; i++) {
        e.writeLong(r.nextLong() % 0x7FL); // half fit in 1, half in 2
        e.writeLong(r.nextLong() % 0x1FFFFFL); // half fit in <=3, half in 4
        e.writeLong(r.nextLong() % 0x3FFFFFFFFL); // half in <=5, half in 6
        e.writeLong(r.nextLong() % 0x1FFFFFFFFFFFFL); // half in <=8, half in 9
      }
      e.writeArrayEnd();
    }

View Full Code Here

      Random r = newRandom();
      for (int i = 0; i < count /4; i++) {
        e.writeLong(r.nextLong() % 0x7FL); // half fit in 1, half in 2
        e.writeLong(r.nextLong() % 0x1FFFFFL); // half fit in <=3, half in 4
        e.writeLong(r.nextLong() % 0x3FFFFFFFFL); // half in <=5, half in 6
        e.writeLong(r.nextLong() % 0x1FFFFFFFFFFFFL); // half in <=8, half in 9
      }
      e.writeArrayEnd();
    }

    @Override
View Full Code Here

    public static boolean acquireLock(FileSystemManager fsManager, FileObject fo) {
       
        // generate a random lock value to ensure that there are no two parties
        // processing the same file
        Random random = new Random();
        byte[] lockValue = String.valueOf(random.nextLong()).getBytes();
       
        try {
            // check whether there is an existing lock for this item, if so it is assumed
            // to be processed by an another listener (downloading) or a sender (uploading)
            // lock file is derived by attaching the ".lock" second extension to the file name
View Full Code Here

    int numberOfRows = 10000;

    Random random = new Random(2112L);
    for (int row = 0; row < numberOfRows; row++) {
      Put put = new Put(Bytes.toBytes(random.nextLong()));
      put.add(FAMILY_1_NAME, INT_QUAL_NAME, Bytes.toBytes(row));
      final String str = String.format("%010d", row % 1000);
      put.add(FAMILY_1_NAME, BYTES_QUAL_NAME, str.getBytes());
      put.add(FAMILY_2_NAME, CHARS_QUAL_NAME, Bytes.toBytes(str.toCharArray()));
      region.put(put);
View Full Code Here

          } else if (n2 == 1) {
            final int docFreqThresh = _TestUtil.nextInt(random, 2, 100);
            final int tii = _TestUtil.nextInt(random, 1, 100);
            selector = new VariableGapTermsIndexWriter.EveryNOrDocFreqTermSelector(docFreqThresh, tii);
          } else {
            final long seed2 = random.nextLong();
            final int gap = _TestUtil.nextInt(random, 2, 40);
            if (LuceneTestCase.VERBOSE) {
             System.out.println("MockRandomCodec: random-gap terms index (max gap=" + gap + ")");
            }
           selector = new VariableGapTermsIndexWriter.IndexTermSelector() {
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.