Package java.util

Examples of java.util.Random.nextBoolean()


      float[] orig = new float[16 * 1024 * 1024];
      MutableSparseFloatArray arr = new MutableSparseFloatArray(new float[orig.length]);

      for (int i = 0; i < 32 * 1024; i++) {
        int idx = r.nextInt(orig.length);
        if (r.nextBoolean()) {
          assertTrue("orig " + orig[idx] + " not the same as arr " + arr.get(idx) + " at idx="
              + idx, orig[idx] == arr.get(idx));
        } else {
          float val = r.nextFloat();
          orig[idx] = val;
View Full Code Here


  public void test2() throws Exception {
    Random random = random();
    final int NUM_DOCS = atLeast(100);
    final Directory dir = newDirectory();
    final RandomIndexWriter writer = new RandomIndexWriter(random, dir);
    final boolean allowDups = random.nextBoolean();
    final Set<String> seen = new HashSet<String>();
    if (VERBOSE) {
      System.out.println("TEST: NUM_DOCS=" + NUM_DOCS + " allowDups=" + allowDups);
    }
    int numDocs = 0;
View Full Code Here

    final List<BytesRef> docValues = new ArrayList<BytesRef>();

    // TODO: deletions
    while (numDocs < NUM_DOCS) {
      final String s;
      if (random.nextBoolean()) {
        s = _TestUtil.randomSimpleString(random);
      } else {
        s = _TestUtil.randomUnicodeString(random);
      }
      final BytesRef br = new BytesRef(s);
View Full Code Here

            /*
             * First random determines +/-, second random determines how far to
             * go in that direction. -cgs
             */
            Random random = getRandomNumberGenerator();
            double variance = (random.nextBoolean() ? collisionAvoidanceFactor : -collisionAvoidanceFactor)
                              * random.nextDouble();
            redeliveryDelayResult += redeliveryDelayResult * variance;
        }

        // ensure the calculated result is not bigger than the max delay (if configured)
View Full Code Here

            final int rels = rnd.nextInt(relsPerNode);
            nodeFile.write(node+"\t"+rels+"\tTEST\t"+node+"\n");
            for (int rel = rels; rel >= 0; rel--) {
                relCount++;
                final int target = node + rnd.nextInt(nodes -node);
                final boolean outgoing = rnd.nextBoolean();
                if (outgoing) {
                    relFile.write(node + "\t" + target + "\t" + types[rel % numTypes] + "\t" + "Property"+"\t" + relCount+ "\n");
                } else {
                    relFile.write(target + "\t" + node + "\t" + types[rel % numTypes] + "\t" + "Property"+"\t" + relCount+ "\n");
                }
View Full Code Here

        form.setItemDataSource(item);
        for (Iterator<?> i = item.getItemPropertyIds().iterator(); i.hasNext();) {
            Object property = i.next();
            Field<?> f = form.getField(property);

            f.setRequired(r.nextBoolean());
            if (r.nextBoolean()) {
                f.setIcon(new ThemeResource("icons/16/document-add.png"));
            }
            if (r.nextBoolean()) {
                f.setCaption(null);
View Full Code Here

        for (Iterator<?> i = item.getItemPropertyIds().iterator(); i.hasNext();) {
            Object property = i.next();
            Field<?> f = form.getField(property);

            f.setRequired(r.nextBoolean());
            if (r.nextBoolean()) {
                f.setIcon(new ThemeResource("icons/16/document-add.png"));
            }
            if (r.nextBoolean()) {
                f.setCaption(null);
            }
View Full Code Here

            f.setRequired(r.nextBoolean());
            if (r.nextBoolean()) {
                f.setIcon(new ThemeResource("icons/16/document-add.png"));
            }
            if (r.nextBoolean()) {
                f.setCaption(null);
            }

            f.addValidator(new StringLengthValidator("Error", 10, 8, false));
        }
View Full Code Here

      FireworkMeta data = fw.getFireworkMeta();
      data.addEffect(FireworkEffect
          .builder()
          .with(FireworkEffect.Type.values()[gen
              .nextInt(FireworkEffect.Type.values().length)])
          .flicker(gen.nextBoolean())
          .trail(gen.nextBoolean())
          .withColor(
              Color.fromRGB(gen.nextInt(255), gen.nextInt(255),
                  gen.nextInt(255)))
          .withFade(
View Full Code Here

      data.addEffect(FireworkEffect
          .builder()
          .with(FireworkEffect.Type.values()[gen
              .nextInt(FireworkEffect.Type.values().length)])
          .flicker(gen.nextBoolean())
          .trail(gen.nextBoolean())
          .withColor(
              Color.fromRGB(gen.nextInt(255), gen.nextInt(255),
                  gen.nextInt(255)))
          .withFade(
              Color.fromRGB(gen.nextInt(255), gen.nextInt(255),
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.