The list of methods to do Random Char are organized into topic(s).
char
createRandomChar() create Random Char
return (char) ('a' + (Math.random() * ('z' - 'a')));
String
getRandomChar() get Random Char
Random random = new Random();
String[] s = { "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T",
"U", "V", "W", "X", "Y", "Z" };
String rand = "";
if (random.nextBoolean()) {
rand = String.valueOf(random.nextInt(10));
} else {
int index = random.nextInt(25);
...
char
getRandomChar() get Random Char
int value = getRandom().nextInt(94) + 32;
char c = (char) ((value == 34 || value == 39 || value == 92) ? value + (getRandom().nextBoolean() ? 1 : -1)
: value);
return c;
String
getRandomChar() get Random Char
Random i = new Random();
return chars[i.nextInt(chars.length)];
String
getRandomChar(int size) Description:
StringBuilder sb = new StringBuilder();
for (int i = 0; i < size; i++) {
switch (RANDOM.nextInt(10) % 3) {
case 0:
sb.append((char) ('0' + RANDOM.nextInt(10)));
break;
case 1:
sb.append((char) ('a' + RANDOM.nextInt(26)));
...
char
getRandomChar(int x) Gets random char.
Random r = new Random();
char c = '0';
switch (x) {
case 0:
c = (char) (r.nextInt(10) + 48);
break;
case 1:
c = (char) (r.nextInt(26) + 97);
...
char
getRandomChar(int[][] ranges, char differentThen, boolean caseSensitive, Random random) Get a random char in given ranges, different than given char
ArrayList<Character> chars = getAllCharsInRange(ranges);
if (differentThen != ' ') {
if (caseSensitive) {
chars.remove(new Character(differentThen));
} else {
chars.remove(new Character((char) ((differentThen + "").toUpperCase().charAt(0))));
chars.remove(new Character((char) ((differentThen + "").toLowerCase().charAt(0))));
int index = getRandomInt(0, chars.size() - 1, random);
return chars.get(index);
char
getRandomChar(Random random, int type) The next two methods are used to generate the random password for the self-signed certificate.
char generatedChar;
int next = random.nextInt();
int d;
switch (type) {
case 0:
d = next % 10;
if (d < 0) {
d = d * -1;
...