Here you can find the source of randInt(int min, int max)
Parameter | Description |
---|---|
min | Lower bound of random interval |
max | Upper bound of random interval |
public static int randInt(int min, int max)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { private static Random mRandom = new Random(); /**/*from w w w. j av a 2 s .co m*/ * * @param min Lower bound of random interval * @param max Upper bound of random interval * @return Random integer number from min to max interval */ public static int randInt(int min, int max) { return mRandom.nextInt((max - min) + 1) + min; } }