Java tutorial
//package com.java2s; import java.util.Random; public class Main { public static int getRandomNumber(int start, int end) { end++; Random random = new Random(); int result = -1; if (start == 0) { result = random.nextInt(end); } else { result = random.nextInt(end); if (result < start) { result = result + start; } } return result; } }