Here you can find the source of generateRandomIntUpto(int max)
public static int generateRandomIntUpto(int max)
//package com.java2s; //License from project: Apache License import java.util.Random; public class Main { public static final Random RANDOM = new Random(System.currentTimeMillis()); /**//w ww.j av a 2 s .c o m * @return random int between 0 and max-1. e.g. param of 10 returns 0->9 */ public static int generateRandomIntUpto(int max) { return nextInt(max); } public static int nextInt(int n) { return RANDOM.nextInt(n); } public static int nextInt() { return RANDOM.nextInt(); } }