Java Random Number getRandomNumber()

Here you can find the source of getRandomNumber()

Description

get Random Number

License

Open Source License

Return

4 digit random Integer number

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 Random RANDOM = new Random();

    /**/*w  ww .j  av  a2 s  .  c om*/
     * @return 4 digit random Integer number
     */
    public static int getRandomNumber() {
        return RANDOM.nextInt(10000);
    }

    /**
     * @return random Integer number between 0 and parameter max
     */
    public static int getRandomNumber(int max) {
        return RANDOM.nextInt(max);
    }
}

Related

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