Code example for SecureRandom

Methods: nextInt

0
	public double getRandomDouble() { 
		return secureRandom.nextDouble();
	} 
 
	public int getRandomInt() { 
		return secureRandom.nextInt();
	} 
 
	public long getRandomLong() { 
		return secureRandom.nextLong();
	} 
 
	public String getRandomString(int length, String charset) {
		StringBuilder sb = new StringBuilder();
		for (int loop = 0; loop < length; loop++) {
			int index = secureRandom.nextInt(charset.length());
			sb.append(charset.charAt(index));
		} 
		return sb.toString();
	} 
}