Here you can find the source of getRandomIntegerInRange(Random random, int i, int j)
public static int getRandomIntegerInRange(Random random, int i, int j)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { public static int getRandomIntegerInRange(Random random, int i, int j) { if (i >= j) { return i; } else {// ww w. j av a 2 s .co m return random.nextInt((j - i) + 1) + i; } } }