Java Random Char getRandomChar()

Here you can find the source of getRandomChar()

Description

get Random Char

License

LGPL

Declaration

public static char getRandomChar() 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.util.Random;

public class Main {
    private static Random random = new Random(23L);

    public static char getRandomChar() {
        int value = getRandom().nextInt(94) + 32;
        char c = (char) ((value == 34 || value == 39 || value == 92) ? value
                + (getRandom().nextBoolean() ? 1 : -1)
                : value);//from  w  w  w .  j  a  va  2 s  .  c o  m
        return c;//discarding " ' and \
    }

    public static Random getRandom() {
        return random;
    }
}

Related

  1. createRandomChar()
  2. getRandomChar()
  3. getRandomChar()
  4. getRandomChar(boolean number, boolean lower, boolean upper, boolean other, String extra, Random _random)
  5. getRandomChar(int size)