Here you can find the source of randomChar()
public static char randomChar()
//package com.java2s; //License from project: Apache License import java.util.Random; public class Main { private static final char[] CHARS = new char[] { 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm' }; private static Random random; public static char randomChar() { int len = uniform(0, CHARS.length); return CHARS[len]; }/*from w w w. ja va2 s . c om*/ public static double uniform() { return random.nextDouble(); } public static int uniform(int n) { if (n <= 0) { throw new IllegalArgumentException("argument must be positive"); } return random.nextInt(n); } public static int uniform(int a, int b) { if ((b <= a) || ((long) b - a >= Integer.MAX_VALUE)) { throw new IllegalArgumentException("invalid range: [" + a + ", " + b + "]"); } return a + uniform(b - a); } public static double uniform(double a, double b) { if (!(a < b)) { throw new IllegalArgumentException("invalid range: [" + a + ", " + b + "]"); } return a + uniform() * (b - a); } }