Here you can find the source of randomChar()
public static char randomChar()
//package com.java2s; //License from project: Apache License public class Main { public static char randomChar() { char[] chars = { 'a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F', 'g', 'G', 'h', 'H', 'i', 'I', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N', 'o', 'O', 'p', 'P', 'q', 'Q', 'r', 'R', 's', 'S', 't', 'T', 'u', 'U', 'v', 'V', 'w', 'W', 'x', 'X', 'y', 'Y', 'z', 'Z' }; int index = (int) (Math.random() * 52.0D) - 1; if (index < 0) { index = 0;/* ww w . j av a2s .com*/ } return chars[index]; } }