Here you can find the source of random(long max)
public static long random(long max)
//package com.java2s; //License from project: Apache License public class Main { public static long random(long max) { return (long) (Math.random() * max); }/*from ww w. j a v a 2s . co m*/ public static int random(int max) { return (int) (Math.random() * max); } }