Java examples for java.util:Random Int
Get a random number that lies between min and max.
//package com.java2s; public class Main { /**//from w w w. ja v a 2 s.c o m * Get a random number that lies between min and max. * @param min Minimum value of the output. * @param max Maximum value of the output. * @return */ public static int getRandomNumber(int min, int max) { int randomNumber = min + (int) (Math.random() * ((max - min) + 1)); return randomNumber; } }