Package java.util

Examples of java.util.Random.nextBoolean()


                int len = ARRAY_TEST_LENGTHS[i-1];
                data = new double[len];
                for (int ix = 0; ix < len; ++ix) {
                    // Need to scale: nextDouble is [0.0, 1.0[
                    double value = rnd.nextDouble();
                    if (rnd.nextBoolean()) {
                        value = (value * rnd.nextLong());
                    }
                    if (rnd.nextBoolean()) {
                        value = -value;
                    }
View Full Code Here


                    // Need to scale: nextDouble is [0.0, 1.0[
                    double value = rnd.nextDouble();
                    if (rnd.nextBoolean()) {
                        value = (value * rnd.nextLong());
                    }
                    if (rnd.nextBoolean()) {
                        value = -value;
                    }
                    data[ix] = value;
                }
            }
View Full Code Here

        }

        Random rnd = new Random( );
        for ( int i = 1; i <= numGuests; i++ )
        {
            char sex = rnd.nextBoolean( ) ? 'm' : 'f';
            if ( sex == 'm' && maleCount == maxMale )
            {
                sex = 'f';
            }
            if ( sex == 'f' && femaleCount == maxFemale )
View Full Code Here

        Random rnd = new Random( );
        for ( int i = 1; i <= numGuests; i++ )
        {

            char sex = rnd.nextBoolean( ) ? 'm' : 'f';
            if ( sex == 'm' && maleCount == maxMale ) sex = 'f';
            if ( sex == 'f' && femaleCount == maxFemale ) sex = 'm';
            if ( sex == 'm' ) maleCount++;
            if ( sex == 'f' ) femaleCount++;
View Full Code Here

        }

        Random rnd = new Random( );
        for ( int i = 1; i <= numGuests; i++ )
        {
            char sex = rnd.nextBoolean( ) ? 'm' : 'f';
            if ( sex == 'm' && maleCount == maxMale )
            {
                sex = 'f';
            }
            if ( sex == 'f' && femaleCount == maxFemale )
View Full Code Here

        Delete del = new Delete(row);
        for (int iCol = 0; iCol < numColsPerRow; ++iCol) {
          final byte[] cf = cfBytes[rand.nextInt(numCF)];
          final long ts = rand.nextInt();
          final byte[] qual = Bytes.toBytes("col" + iCol);
          if (rand.nextBoolean()) {
            final byte[] value = Bytes.toBytes("value_for_row_" + iRow +
                "_cf_" + Bytes.toStringBinary(cf) + "_col_" + iCol + "_ts_" +
                ts + "_random_" + rand.nextLong());
            put.add(cf, qual, ts, value);
          } else if (rand.nextDouble() < 0.8) {
View Full Code Here

      int numPositionalRead = 0;
      int numWithOnDiskSize = 0;
      while (System.currentTimeMillis() < endTime) {
        int blockId = rand.nextInt(NUM_TEST_BLOCKS);
        long offset = offsets.get(blockId);
        boolean pread = rand.nextBoolean();
        boolean withOnDiskSize = rand.nextBoolean();
        long expectedSize =
          (blockId == NUM_TEST_BLOCKS - 1 ? fileSize
              : offsets.get(blockId + 1)) - offset;
View Full Code Here

      int numWithOnDiskSize = 0;
      while (System.currentTimeMillis() < endTime) {
        int blockId = rand.nextInt(NUM_TEST_BLOCKS);
        long offset = offsets.get(blockId);
        boolean pread = rand.nextBoolean();
        boolean withOnDiskSize = rand.nextBoolean();
        long expectedSize =
          (blockId == NUM_TEST_BLOCKS - 1 ? fileSize
              : offsets.get(blockId + 1)) - offset;

        HFileBlock b;
View Full Code Here

    doc.add(newField("field", "go 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20", Field.Store.NO, Field.Index.ANALYZED));
    int num = atLeast(3);
    for (int iter = 0; iter < num; iter++) {
      int count = 0;

      final boolean doIndexing = r.nextBoolean();
      if (VERBOSE) {
        System.out.println("TEST: iter doIndexing=" + doIndexing);
      }
      if (doIndexing) {
        // Add docs until a flush is triggered
View Full Code Here

    try {

      // increase number of iterations for more complete testing
      for (int i=0; i<1000; i++) {
        int level = rnd.nextInt(3);
        q1 = randBoolQuery(new Random(rnd.nextLong()), rnd.nextBoolean(), level, field, vals, null);
       
        // Can't sort by relevance since floating point numbers may not quite
        // match up.
        Sort sort = Sort.INDEXORDER;
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.