Java Random Int generateRandomSeed(int min, int max)

Here you can find the source of generateRandomSeed(int min, int max)

Description

Generate min ~ max random number

License

Apache License

Parameter

Parameter Description
min a parameter
max a parameter

Declaration

public static int generateRandomSeed(int min, int max) 

Method Source Code

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

public class Main {
    /**//  w w  w .  j a  va2s. co  m
     * Generate min ~ max random number
     *
     * @param min
     * @param max
     * @return
     */
    public static int generateRandomSeed(int min, int max) {
        if (min == max) {
            return min;
        }

        double seed = Math.random() * (max - min) + min;
        return (int) Math.round(seed);
    }
}

Related

  1. generateRandomIntObj(int range, int noOfElements)
  2. generateRandomInts(int range, int noOfElements)
  3. generateRandomIntUpto(int max)
  4. generateRandomIntValue()
  5. generateRandomNoInRange(int max, int min)
  6. generateRandomTargetId(final String uniqueId, final int count)
  7. getIntRandom(int i)
  8. getIntRandomReqId()
  9. getIntRandomValue(int paramInt)