Here you can find the source of generateRandomNumber(int start, int end)
public static int generateRandomNumber(int start, int end)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w . j av a 2s.c om*/ * Generates the random number within the range. * * @return Random number within the range. */ public static int generateRandomNumber(int start, int end) { double randomValue = Math.random(); int randomNumber = (int) (start + Math.round(randomValue * (end - start))); return randomNumber; } }