Package java.util

Examples of java.util.Random.nextFloat()


    final RepeatingTokenStream ts = new RepeatingTokenStream(val);

    Analyzer analyzer = new Analyzer() {
      @Override
      public TokenStream tokenStream(String fieldName, Reader reader) {
        if (random.nextFloat() < percentDocs) ts.num = random.nextInt(maxTF)+1;
        else ts.num=0;
        return ts;
      }
    };
View Full Code Here


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

    void genData(Encoder e) throws IOException {
      e.writeArrayStart();
      e.setItemCount(count);
      Random r = newRandom();
      for (int i = 0; i < count; i++) {
        e.writeFloat(r.nextFloat());
      }
      e.writeArrayEnd();
    }

    @Override
View Full Code Here

    void genData(Encoder e) throws IOException {
      e.writeArrayStart();
      e.setItemCount(count);
      Random r = newRandom();
      for (int i = 0; i < count; i++) {
        e.writeDouble(r.nextFloat());
      }
      e.writeArrayEnd();
    }
    @Override
    void readInternal(Decoder d) throws IOException {
View Full Code Here

   
    {
      final long seed = random().nextLong();
      Random r = new Random(seed);
      CommonTermsQuery left = new CommonTermsQuery(randomOccur(r),
          randomOccur(r), r.nextFloat(), r.nextBoolean());
      int leftTerms = atLeast(r, 2);
      for (int i = 0; i < leftTerms; i++) {
        left.add(new Term(_TestUtil.randomRealisticUnicodeString(r), _TestUtil
            .randomRealisticUnicodeString(r)));
      }
View Full Code Here

      left.setHighFreqMinimumNumberShouldMatch(r.nextInt(4));
      left.setLowFreqMinimumNumberShouldMatch(r.nextInt(4));
     
      r = new Random(seed);
      CommonTermsQuery right = new CommonTermsQuery(randomOccur(r),
          randomOccur(r), r.nextFloat(), r.nextBoolean());
      int rightTerms = atLeast(r, 2);
      for (int i = 0; i < rightTerms; i++) {
        right.add(new Term(_TestUtil.randomRealisticUnicodeString(r), _TestUtil
            .randomRealisticUnicodeString(r)));
      }
View Full Code Here

      float[] orig = new float[1024];
      MutableSparseFloatArray fromEmpty = new MutableSparseFloatArray(new float[1024]);
      float density = 0.2f;
      int idx = 0;
      while (rand.nextFloat() > density) {
        idx++;
      }
      while (idx < orig.length) {
        float val = rand.nextFloat();
        orig[idx] = val;
View Full Code Here

      int idx = 0;
      while (rand.nextFloat() > density) {
        idx++;
      }
      while (idx < orig.length) {
        float val = rand.nextFloat();
        orig[idx] = val;
        fromEmpty.set(idx, val);
        idx += 1;
        while (rand.nextDouble() > density) {
          idx++;
View Full Code Here

      MutableSparseFloatArray fromPartial = new MutableSparseFloatArray(copy);

      // do 128 modifications
      int mods = 128;
      for (int i = 0; i < mods; i++) {
        float val = rand.nextFloat();
        idx = rand.nextInt(orig.length);
        orig[idx] = val;
        fromEmpty.set(idx, val);
        fromPartial.set(idx, val);
      }
View Full Code Here

        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;
          arr.set(idx, val);
        }
      }
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.