Here you can find the source of nextLong()
public static double nextLong()
//package com.java2s; //License from project: LGPL import java.util.Random; public class Main { public static Random random = new Random(); public static long nextLong(long min, long max) { return (long) ((random.nextDouble() * (max - min)) + min); }/*from w w w. j a v a 2s.c o m*/ public static long nextLong(long bound) { return (long) (random.nextDouble() * (bound)); } public static double nextLong() { return random.nextDouble(); } public static double nextDouble(double min, double max) { return (random.nextDouble() * (max - min)) + min; } public static double nextDouble(double bound) { return (random.nextDouble() * (bound)); } public static long nextDouble() { return (long) random.nextDouble(); } }