Here you can find the source of randomCharacter(boolean includeSymbols)
public static char randomCharacter(boolean includeSymbols)
//package com.java2s; //License from project: Open Source License public class Main { private static String CHARS = "123456789ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghijklmnpqrstuvwxyz"; private static String SYMBOLS_AND_CHARS = "{|}~!#$%&()*+,-.:;<=>?@[]^_" + CHARS; public static char randomCharacter(boolean includeSymbols) { if (includeSymbols) { int ival = (int) (Math.random() * SYMBOLS_AND_CHARS.length()); return SYMBOLS_AND_CHARS.charAt(ival); } else {/*from w w w . ja v a 2 s . co m*/ int ival = (int) (Math.random() * CHARS.length()); return CHARS.charAt(ival); } } }