List of utility methods to do Random Char
char | getRandomCharacter() get Random Character char c = (char) (rnd.nextInt(26) + 'a'); return c; |
char | getRandomCharacter() get Random Character final char[] chars = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; return chars[getNextRandom(26)]; |
char | randomChar() random Char int len = uniform(0, CHARS.length); return CHARS[len]; |
char | randomChar() random Char int num = (int) Math.floor(Math.random() * 60); if (num < 26) return (char) ((int) 'a' + num); num -= 26; if (num < 26) return (char) ((int) 'A' + num); num -= 26; if (num < 1) ... |
char | randomChar() random Char return (char) (int) (Math.random() * 26.0D + 97.0D); |
char | randomChar() random Char 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; return chars[index]; ... |
char | randomChar() random Char return alphabet.charAt(random.nextInt(alphabet.length()));
|
char | randomChar(char[] letters) random Char int index = r.nextInt(letters.length); return letters[index]; |
char | randomChar(Random r) random Char switch (r.nextInt(101) / 100) { case 0: case 1: return (char) (32 + r.nextInt(127 - 32)); case 2: case 3: case 4: case 5: ... |
char | randomCharacter(boolean includeSymbols) random Character if (includeSymbols) { int ival = (int) (Math.random() * SYMBOLS_AND_CHARS.length()); return SYMBOLS_AND_CHARS.charAt(ival); } else { int ival = (int) (Math.random() * CHARS.length()); return CHARS.charAt(ival); |