Examples of nextFloat()


Examples of java.util.Random.nextFloat()

      arr = new MutableSparseFloatArray(new float[orig.length]);
      int[] idxs = new int[1024*1024];
      float[] vals = new float[idxs.length];
      for (int i = 0; i < idxs.length; i++) {
        idxs[i] = r.nextInt(orig.length);
        vals[i] = r.nextFloat();
      }
     
      long markTime = System.currentTimeMillis();
      for (int i = 0; i < idxs.length; i++) {
        orig[i] = vals[i];
View Full Code Here

Examples of java.util.Random.nextFloat()

    try {
      float[] orig = new float[32*1024*1024];
      float density = 0.4f;
      Random rand = new Random(SEED);
      int idx = 0;
      while (rand.nextFloat() > density) {
        idx++;
      }
      int count = 0;
      while (idx < orig.length) {
        orig[idx] = rand.nextFloat();
View Full Code Here

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

Examples of java.util.Random.nextFloat()

  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

Examples of java.util.Random.nextFloat()

    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

Examples of java.util.Random.nextFloat()

    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

Examples of java.util.Random.nextFloat()

    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

Examples of java.util.Random.nextFloat()

            });

        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

Examples of java.util.Random.nextFloat()

  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

Examples of java.util.Random.nextFloat()

  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
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.