Here you can find the source of getRandomInt()
public static int getRandomInt()
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { private static final Random random = new Random(); /**/*from w ww . j a va 2 s .c o m*/ * Generates a new random integer * * @return random integer */ public static int getRandomInt() { return random.nextInt(); } /** * Generates a new random integer between 0 (inclusive) * and the given maximum value (exclusive) * * @param max value (exclusive) * @return random integer */ public static int getRandomInt(int max) { return random.nextInt(max); } /** * Generates a new random integer between the minimum * value (inclusive) and maximum value (exclusive) * * @param min minimum value (inclusive) * @param max maximum value (exclusive) * @return random integer */ public static int getRandomInt(int min, int max) { return random.nextInt(max - min) + min; } }