Here you can find the source of getRandomNumber()
public static int getRandomNumber()
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { private static final String CHAR_LIST = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; public static int getRandomNumber() { int randomInt = 0; Random randomGenerator = new Random(); randomInt = randomGenerator.nextInt(CHAR_LIST.length()); if (randomInt - 1 == -1) { return randomInt; } else {/* w w w . j ava 2 s .c o m*/ return randomInt - 1; } } }