Java Random Number getRandomNumber(int num)

Here you can find the source of getRandomNumber(int num)

Description

get Random Number

License

Open Source License

Parameter

Parameter Description
num a parameter

Declaration

public static int getRandomNumber(int num) 

Method Source Code


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

import java.util.Random;

public class Main {
    static Random generator = new Random(System.currentTimeMillis());

    /**/*from w w w  .j  a  v a 2s. co m*/
     * @param num
     * @return
     */
    public static int getRandomNumber(int num) {

        int randomNumber = generator.nextInt(num);
        return randomNumber;
    }
}

Related

  1. getRandomNumber(int length)
  2. getRandomNumber(int length)
  3. getRandomNumber(int length)
  4. getRandomNumber(int max, boolean include0)
  5. getRandomNumber(int max, int count)
  6. getRandomNumber(int randomCount)
  7. getRandomNumber(int startNumber, int endNumber)
  8. getRandomNumberBetween(int min, int max)
  9. getRandomNumberFixLength()