Here you can find the source of rand(int lo, int hi)
private static int rand(int lo, int hi)
//package com.java2s; public class Main { private static int rand(int lo, int hi) { java.util.Random rn = new java.util.Random(); int n = hi - lo + 1; int i = rn.nextInt(n); if (i < 0) i = -i;/* w w w . j a v a 2s. c o m*/ return lo + i; } }