Here you can find the source of randInt(int min, int max)
Parameter | Description |
---|---|
min | The smallest possible number |
max | The largest possible number |
public static int randInt(int min, int max)
//package com.java2s; //License from project: LGPL import java.util.Random; public class Main { /**//from ww w .ja va 2 s . co m * Generates a random integer between the min and max values * * @param min The smallest possible number * @param max The largest possible number * @return A random number between the min and max parameters */ public static int randInt(int min, int max) { Random rand = new Random(); return rand.nextInt(max - min + 1) + min; } }