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 generator = new Random(); public static int getRandomInt() { return getRandomInt(0, 9); }//from w w w .j a va2 s . co m public static int getRandomInt(final int a, final int b) { return generator.nextInt(b - a + 1) + a; } }