Here you can find the source of getRandomInt(int minimum, int maximum)
public static int getRandomInt(int minimum, int maximum)
//package com.java2s; //License from project: Apache License import java.util.Random; public class Main { public static Random RANDOM = new Random(); /***********************************************************************/ public static int getRandomInt(int minimum, int maximum) { int diff = maximum - minimum; if (diff == 0) { return maximum; } else {/*from w w w . j ava 2s . co m*/ return RANDOM.nextInt(diff) + minimum; } } }