Here you can find the source of getRandomInt(Random rand, int lower, int upper)
public static final int getRandomInt(Random rand, int lower, int upper)
//package com.java2s; //License from project: Apache License import java.util.Random; public class Main { public static final int getRandomInt(Random rand, int lower, int upper) { int num = (int) Math.floor(rand.nextDouble() * (upper - lower + 1)); return num + lower; }// w w w .j a v a 2 s. com }