Package java.util

Examples of java.util.Random.nextFloat()


        s.myBool = new Boolean(rand.nextBoolean());
        s.myByte = new Byte((byte) rand.nextInt(Byte.MAX_VALUE));
        s.myShort = new Short((short) rand.nextInt(Short.MAX_VALUE));
        s.myInteger = new Integer(rand.nextInt());
        s.myLong = new Long(rand.nextLong());
        s.myFloat = new Float(rand.nextFloat());
        s.myDouble = new Double(rand.nextDouble());
        s.myBigDecimal = new BigDecimal(rand.nextDouble());
        s.myString = Long.toHexString(rand.nextLong());
        s.myUtilDate = new java.util.Date(rand.nextLong());
        s.mySqlDate = new java.sql.Date(rand.nextLong());
View Full Code Here


    System.out.println("Clearing the framebuffer a gazillion times...");

    Random rand = new Random(System.currentTimeMillis());
    for ( int i = 0; i < clears; i++ ) {
      glClearColor(rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), 1.0f);
      glClear(GL_COLOR_BUFFER_BIT);
    }

    GLSync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
View Full Code Here

    System.out.println("Clearing the framebuffer a gazillion times...");

    Random rand = new Random(System.currentTimeMillis());
    for ( int i = 0; i < clears; i++ ) {
      glClearColor(rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), 1.0f);
      glClear(GL_COLOR_BUFFER_BIT);
    }

    GLSync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
View Full Code Here

    System.out.println("Clearing the framebuffer a gazillion times...");

    Random rand = new Random(System.currentTimeMillis());
    for ( int i = 0; i < clears; i++ ) {
      glClearColor(rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), 1.0f);
      glClear(GL_COLOR_BUFFER_BIT);
    }

    GLSync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
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++;
      }
      int count = 0;
      while (idx < orig.length) {
        float val = rand.nextFloat();
View Full Code Here

      while (rand.nextFloat() > density) {
        idx++;
      }
      int count = 0;
      while (idx < orig.length) {
        float val = rand.nextFloat();
        orig[idx] = val;
        fromEmpty.set(idx, val);
        count++;
        idx += 1;
        while (rand.nextDouble() > density) {
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

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

      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

    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

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.