Examples of nextBytes()


Examples of java.util.Random.nextBytes()

        Random rnd = new Random()// @todo need a different seed, this is now time based and I
        // would prefer something different, like an object address
        // get the random number, instead of getting an integer and converting that to base64 later,
        // we get a string and narrow that down to base64, use the top 6 bits of the characters
        // as they are more random than the bottom ones...
        rnd.nextBytes(VALUE);    // get some random characters
        VALUE[3] = BASE64[((VALUE[3] >> 2) & 0x3f)];
        VALUE[4] = BASE64[((VALUE[4] >> 2) & 0x3f)];
        VALUE[5] = BASE64[((VALUE[5] >> 2) & 0x3f)];
        VALUE[6] = BASE64[((VALUE[6] >> 2) & 0x3f)];
        VALUE[7] = BASE64[((VALUE[7] >> 2) & 0x3f)];
View Full Code Here

Examples of java.util.Random.nextBytes()

 
  public static byte[] generateRandomByteArray(int length) {
    Random random = new Random();
   
    byte[] bytes = new byte[length];
    random.nextBytes(bytes);

    return bytes;
  }
 
 
View Full Code Here

Examples of java.util.Random.nextBytes()

                    }
                }
                else if(out!=null) {
                    Random rnd = new Random();
                    while(true) {
                        rnd.nextBytes(buf);
                        out.write(buf);
                    }
                }
                timestamp= 0;
                return;
View Full Code Here

Examples of java.util.Random.nextBytes()

 
  public static byte[] generateRandomByteArray(int length) {
    Random random = new Random();
   
    byte[] bytes = new byte[length];
    random.nextBytes(bytes);

    return bytes;
  }
 
 
View Full Code Here

Examples of java.util.Random.nextBytes()

    }
   
    public static void main(String[] args) {
      byte[] b = new byte[16];
    Random random = new Random();
    random.nextBytes(b);
    System.out.println(HexString.toHexString(b));
    System.out.println(TypeUtil.toString(b, 16));
  }
}
View Full Code Here

Examples of java.util.Random.nextBytes()

        Random rnd = new Random();
        int width = 5;
        int height = 5;
        int bpp = 3;
        byte[] raw = new byte[width * height * bpp];
        rnd.nextBytes(raw);
        System.out.println("raw:   ");
        dump(raw);
        for (int i = 10; i < 15; i++)
        {
            byte[] decoded = new byte[width * height * bpp];
 
View Full Code Here

Examples of java.util.Random.nextBytes()

      // generate it or repeat, it should compress well
      if (0 < i && randomizer.nextFloat() < CHANCE_TO_REPEAT) {
        row = keyValues.get(randomizer.nextInt(keyValues.size())).getRow();
      } else {
        row = new byte[FIELD_LENGTH];
        randomizer.nextBytes(row);
      }
      if (0 == i) {
        family = new byte[FIELD_LENGTH];
        randomizer.nextBytes(family);
      } else {
View Full Code Here

Examples of java.util.Random.nextBytes()

        row = new byte[FIELD_LENGTH];
        randomizer.nextBytes(row);
      }
      if (0 == i) {
        family = new byte[FIELD_LENGTH];
        randomizer.nextBytes(family);
      } else {
        family = keyValues.get(0).getFamily();
      }
      if (0 < i && randomizer.nextFloat() < CHANCE_TO_REPEAT) {
        qualifier = keyValues.get(
View Full Code Here

Examples of java.util.Random.nextBytes()

      if (0 < i && randomizer.nextFloat() < CHANCE_TO_REPEAT) {
        qualifier = keyValues.get(
            randomizer.nextInt(keyValues.size())).getQualifier();
      } else {
        qualifier = new byte[FIELD_LENGTH];
        randomizer.nextBytes(qualifier);
      }
      if (0 < i && randomizer.nextFloat() < CHANCE_TO_REPEAT) {
        value = keyValues.get(randomizer.nextInt(keyValues.size())).getValue();
      } else {
        value = new byte[FIELD_LENGTH];
View Full Code Here

Examples of java.util.Random.nextBytes()

      }
      if (0 < i && randomizer.nextFloat() < CHANCE_TO_REPEAT) {
        value = keyValues.get(randomizer.nextInt(keyValues.size())).getValue();
      } else {
        value = new byte[FIELD_LENGTH];
        randomizer.nextBytes(value);
      }
      if (0 < i && randomizer.nextFloat() < CHANCE_TO_REPEAT) {
        timestamp = keyValues.get(
            randomizer.nextInt(keyValues.size())).getTimestamp();
      } else {
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.