Here you can find the source of randomDouble()
public static double randomDouble()
//package com.java2s; //License from project: Apache License import java.util.Random; public class Main { private static Random r = new Random(); /**//from w w w .j a v a2s . c om * random double value between 0 and 1 * @return */ public static double randomDouble() { return r.nextDouble(); } /** * random double value between begin(inclusive) and end(exclusive) * @param begin * @param end * @return */ public static double randomDouble(double begin, double end) { // (random value - 0.5) * span + middle_of_(begin,end) return (r.nextDouble() - 0.5) * (end - begin) + ((begin + end) / 2); } }