Here you can find the source of randomBytes(Random rand, int size)
public static byte[] randomBytes(Random rand, int size)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { public static byte[] randomBytes(Random rand, int size) { byte[] bytes = new byte[size]; rand.nextBytes(bytes);//from w w w .ja va 2s . c o m return bytes; } }