Java Random Byte Array generateRandomBytes(int size)

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

Description

generate Random Bytes

License

Open Source License

Declaration

public static byte[] generateRandomBytes(int size) 

Method Source Code

//package com.java2s;
/*//w  w w .  j av a  2  s.  c  o  m
 * Copyright (C) Mellanox Technologies Ltd. 2001-2017.  ALL RIGHTS RESERVED.
 * See file LICENSE for terms.
 */

import java.util.Random;

public class Main {
    public static byte[] generateRandomBytes(int size) {
        Random rand = new Random();
        byte[] arr = new byte[size];
        rand.nextBytes(arr);

        return arr;
    }
}

Related

  1. generateRandomBytes(final int pSize)
  2. generateRandomBytes(int n)
  3. generateRandomBytes(int num)
  4. generateRandomBytes(int num_to_generate)
  5. generateRandomBytes(int num_to_generate)
  6. getRandomByteArray(int len)
  7. getRandomBytes()
  8. getRandomBytes(int size)
  9. getRandomBytes(int size)