Here you can find the source of randomInt(int n)
public static int randomInt(int n)
//package com.java2s; //License from project: Apache License public class Main { public static int randomInt(int n) { return (int) (Math.random() * n); }/*from w w w .j a va2s. c o m*/ public static int randomInt(int min, int max) { return randomInt(max + 1 - min) + min; } }