Java Random Number generateRandomNumber(int start, int end)

Here you can find the source of generateRandomNumber(int start, int end)

Description

Generates the random number within the range.

License

Open Source License

Return

Random number within the range.

Declaration

public static int generateRandomNumber(int start, int end) 

Method Source Code

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

public class Main {
    /**/*from  w  w w  .  j av  a  2s.c om*/
     * Generates the random number within the range.
     * 
     * @return Random number within the range.
     */
    public static int generateRandomNumber(int start, int end) {
        double randomValue = Math.random();
        int randomNumber = (int) (start + Math.round(randomValue * (end - start)));
        return randomNumber;
    }
}

Related

  1. generateRandomnumber(int firstNum, int restNum)
  2. generateRandomNumber(int from, int to)
  3. generateRandomNumber(int length)
  4. generateRandomNumber(int min, int max)
  5. generateRandomNumber(int min, int max)
  6. generateRandomNumberBetween(final int low, final int high)
  7. generateRandomNumericString(int maxLength)
  8. generateSaltNumber()
  9. genRandomNum(int pwd_len)