Java Random Int randomIntRange(int low, int high)

Here you can find the source of randomIntRange(int low, int high)

Description

Get a random integer in the given half-open range.

License

Open Source License

Parameter

Parameter Description
low a parameter
high a parameter

Return

int

Declaration

public static int randomIntRange(int low, int high) 

Method Source Code

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

public class Main {
    /**/*from   ww w.  j ava2 s .  c  o m*/
     * Get a random integer in the given half-open range.
     * @param low
     * @param high
     * @return int
     */
    public static int randomIntRange(int low, int high) {
        return low + ((int) Math.floor(Math.random() * (high - low)));
    }
}

Related

  1. randomInteger(int min, int max)
  2. randomIntFromInterval(int min, int max)
  3. randomIntFromRange(int min, int max)
  4. randomIntInInterval(int lower, int upper)
  5. randomIntInRange(int lowerBound, int upperBound)
  6. randomIntWithDigits(int digits)
  7. randomKey(int sLen)
  8. randomMatrix(int x, int y)
  9. randomModuleName(int count)