Here you can find the source of generateRandomBytes(int num_to_generate)
Parameter | Description |
---|---|
num_to_generate | number of bytes to generate |
public static byte[] generateRandomBytes(int num_to_generate)
//package com.java2s; //License from project: Apache License import java.util.Random; public class Main { public static byte[] generateRandomBytes(int num_to_generate) { Random random = new Random(System.currentTimeMillis()); byte[] id = new byte[num_to_generate]; random.nextBytes(id);/*from ww w .j a v a2s .c o m*/ return id; } }