Here you can find the source of random(int min, int max)
Parameter | Description |
---|---|
min | value allowed for random integer |
max | value allowed for the random integer |
public static int random(int min, int max)
//package com.java2s; import java.util.Random; public class Main { private static Random random = new Random(); /**/* w w w . j a va 2 s. co m*/ * Returns random integer in the range specified. * * @param min * value allowed for random integer * @param max * value allowed for the random integer * @return random integer */ public static int random(int min, int max) { int i1 = random.nextInt(max - min + 1) + min; return i1; } }