Here you can find the source of randomNumberWithinRange(int low, int high)
public static int randomNumberWithinRange(int low, int high)
//package com.java2s; //License from project: LGPL public class Main { public static int randomNumberWithinRange(int low, int high) { int result = (int) (Math.random() * (high - low + 1)) + low; return result; }//from w w w . ja v a2 s .c o m }