Java Random Byte Array generateRandomByteArray(int size)

Here you can find the source of generateRandomByteArray(int size)

Description

generate Random Byte Array

License

Open Source License

Declaration

public static byte[] generateRandomByteArray(int size) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Random;

public class Main {
    public static byte[] generateRandomByteArray(int size) {
        return getRandomByteArray(size);
    }//from  w w w . j  a  v  a  2s . co m

    private static byte[] getRandomByteArray(int size) {
        byte[] result = new byte[size];
        Random random = new Random();
        random.nextBytes(result);
        return result;
    }
}

Related

  1. generateRandomArray()
  2. generateRandomBlob()
  3. generateRandomByteArray(int length)
  4. generateRandomByteArray(int length)
  5. generateRandomByteArray(int length, boolean avoid, byte avoidByte)
  6. generateRandomByteArray(int size, Random rnd)
  7. generateRandomBytes()
  8. generateRandomBytes(final int pSize)
  9. generateRandomBytes(int n)