Here you can find the source of randomBytes(int minimumCharacters, int maximumCharacters)
public static byte[] randomBytes(int minimumCharacters, int maximumCharacters)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { private static Random rn = new Random(); public static byte[] randomBytes(int minimumCharacters, int maximumCharacters) { int n = rand(minimumCharacters, maximumCharacters); byte b[] = new byte[n]; for (int i = 0; i < n; i++) b[i] = (byte) rand('a', 'z'); return b; }//from w ww .j av a2 s . c om public static int rand(int lo, int hi) { int n = hi - lo + 1; int i = rn.nextInt() % n; if (i < 0) i = -i; return lo + i; } }