Here you can find the source of getRandomNumberInRange(Random random, int min, int max)
Parameter | Description |
---|---|
random | The random number generator. |
min | The minimum value. |
max | The maximum value. |
public static int getRandomNumberInRange(Random random, int min, int max)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { /**/* w w w . ja v a 2 s. co m*/ * Returns a random number between min and max, inclusive. * * @param random The random number generator. * @param min The minimum value. * @param max The maximum value. * @return A random number between min and max, inclusive. */ public static int getRandomNumberInRange(Random random, int min, int max) { return min + random.nextInt(max - min + 1); } }