Package java.util

Examples of java.util.Random.nextFloat()


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


  public void testGlobalBB() {
    Random rand = new Random(System.currentTimeMillis());
    int count = 0;
    while(count++ <1000) {
      double r = 360.*rand.nextFloat()-180;
      LatLonRect llbb = new LatLonRect(new LatLonPointImpl(20.0, r), 20.0, 360.0);
      double r2 = 360.*rand.nextFloat()-180;
      LatLonPointImpl p = new LatLonPointImpl(30.0, r2);
      assert llbb.contains(p);
    }
View Full Code Here

    Random rand = new Random(System.currentTimeMillis());
    int count = 0;
    while(count++ <1000) {
      double r = 360.*rand.nextFloat()-180;
      LatLonRect llbb = new LatLonRect(new LatLonPointImpl(20.0, r), 20.0, 360.0);
      double r2 = 360.*rand.nextFloat()-180;
      LatLonPointImpl p = new LatLonPointImpl(30.0, r2);
      assert llbb.contains(p);
    }
  }

View Full Code Here

    DataOutputStream dout = new DataOutputStream(out);

    Random r = new Random();
    long start = System.currentTimeMillis();
    for (int i=0; i<(1000*1000);i++) {
      dout.writeFloat(r.nextFloat());
    }
    dout.flush();
    fout.close();
    double took = .001 * (System.currentTimeMillis() - start);
    File f = new File(filenameOut);
View Full Code Here

    DataOutputStream dout = new DataOutputStream(out);

    Random r = new Random();
    long start = System.currentTimeMillis();
    for (int i=0; i<(1000*1000);i++) {
      dout.writeFloat(r.nextFloat());
    }
    fout.flush();
    fout.close();
    double took = .001 * (System.currentTimeMillis() - start);
    File f = new File(filenameOut);
View Full Code Here

            });

        Value map = ValueFactory.mapValue(new Value[] {
                ValueFactory.integerValue(0), ValueFactory.integerValue(Integer.MIN_VALUE),
                ValueFactory.integerValue(rand.nextInt()), ValueFactory.integerValue(Integer.MAX_VALUE),
                ValueFactory.floatValue(rand.nextFloat()), ValueFactory.booleanValue(true),
                ValueFactory.floatValue(rand.nextDouble()), ValueFactory.nilValue(),
            });

        List<Value> values = new ArrayList<Value>();
View Full Code Here

  testFloat(Float.NaN);
  testFloat(Float.NEGATIVE_INFINITY);
  testFloat(Float.POSITIVE_INFINITY);
  Random rand = new Random();
  for (int i = 0; i < 1000; i++) {
      testFloat(rand.nextFloat());
  }
    }

    public void testFloat(float v) throws Exception {
    }
View Full Code Here

  testFloatArray(new float[] { Float.POSITIVE_INFINITY });
  testFloatArray(new float[] { Float.MAX_VALUE, Float.MIN_VALUE, Float.NaN, Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY });
  Random rand = new Random();
  float[] v = new float[100];
  for (int i = 0; i < v.length; ++i) {
      v[i] = rand.nextFloat();
  }
  testFloatArray(v);
    }

    public void testFloatArray(float[] v) throws Exception {
View Full Code Here

        dsend = new double[length];
        drecv = new double[length];

        for (int i = 0; i < length; ++i) {
            dsend[i] = r.nextDouble();
            fsend[i] = r.nextFloat();
            lsend[i] = r.nextLong();
            isend[i] = r.nextInt();
            ssend[i] = (short) r.nextInt();
            csend[i] = (char) r.nextInt();
            bsend[i] = (byte) r.nextInt();
View Full Code Here

    private float[] floatArray(int count)
    {
        Random r = new Random(count);
        float[] result = new float[count];
        for (int i = 0; i < count; ++i) {
            float f = r.nextFloat();
            result[i] = r.nextBoolean() ? -f : f;
        }
        return result;
    }
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.