Java Random Int randomInt(int min, int max)

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

Description

random Int

License

Apache License

Parameter

Parameter Description
min a parameter
max a parameter

Return

int

Declaration

public static int randomInt(int min, int max) 

Method Source Code

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

public class Main {
    /**/*from   w w w. ja v  a  2 s .  c  om*/
     *  @param min
     *  @param max
     *  @return 
     * @return int
     */
    public static int randomInt(int min, int max) {
        return (int) (min + Math.random() * (max - min));
    }
}

Related

  1. randomInt(final int upToNotInclusive)
  2. randomInt(int ceil)
  3. randomInt(int fromInclusive, int toExclusive)
  4. randomInt(int in)
  5. randomInt(int low, int high)
  6. randomInt(int mn, int mx)
  7. randomInt(int n)
  8. RandomInteger()
  9. randomInteger(final int upperRange)