Java Random Int random(int min, int max)

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

Description

random

License

Open Source License

Return

random number in the specified range, both ends inclusive

Declaration

public static int random(int min, int max) 

Method Source Code

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

public class Main {
    /**//from ww  w .j  a  va2s.c o m
     * @return random number in the specified range, both ends inclusive
     */
    public static int random(int min, int max) {
        return (int) Math.round(random((double) min, max));
    }

    /**
     * @see #random(int, int)
     */
    public static double random(double min, double max) {
        return min + Math.random() * (max - min);
    }
}

Related

  1. random(int lo, int hi)
  2. Random(int low, int high)
  3. random(int lowerBound, int upperBound)
  4. random(int maxValue)
  5. random(int min, int max)
  6. random(int min, int max)
  7. random(int min, int max)
  8. random(int min, int max)
  9. random(int min, int max)