Java Random Number getRandomNumber()

Here you can find the source of getRandomNumber()

Description

get Random Number

License

Open Source License

Declaration

public static int getRandomNumber() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Random;

public class Main {
    private static final String CHAR_LIST = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

    public static int getRandomNumber() {
        int randomInt = 0;
        Random randomGenerator = new Random();
        randomInt = randomGenerator.nextInt(CHAR_LIST.length());
        if (randomInt - 1 == -1) {
            return randomInt;
        } else {/* w  w  w .  j  ava 2  s  .c o  m*/
            return randomInt - 1;
        }
    }
}

Related

  1. getRandomNum(int pwd_len)
  2. getRandomNumAndLetterAF(int len)
  3. getRandomNumAndStr(int length)
  4. getRandomNumber()
  5. getRandomNumber()
  6. getRandomNumber()
  7. getRandomNumber()
  8. getRandomNumber(final int from, final int to)
  9. getRandomNumber(final int maxInt, final int minInt)