Java Random Byte Array randomBytes(final int numBytes)

Here you can find the source of randomBytes(final int numBytes)

Description

Generate an array of random bytes

License

Apache License

Parameter

Parameter Description
numBytes The size of the array

Declaration

public static byte[] randomBytes(final int numBytes) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Random;

public class Main {
    public static final Random SEEDED_RANDOM = new Random(192348092834L);

    /**/* w w  w . j  a v  a 2s .  c o  m*/
     * Generate an array of random bytes
     *
     * @param numBytes The size of the array
     */
    public static byte[] randomBytes(final int numBytes) {
        byte[] bytes = new byte[numBytes];
        SEEDED_RANDOM.nextBytes(bytes);
        return bytes;
    }
}

Related

  1. randBytes(int length)
  2. randomByte(byte[] b)
  3. randomByteArray(int length)
  4. randomBytes()
  5. randomBytes(byte[] bytes)
  6. randomBytes(int length)
  7. randomBytes(int length)
  8. randomBytes(int minimumCharacters, int maximumCharacters)
  9. randomBytes(int size)