Here you can find the source of randomDouble(double min, double max)
public static double randomDouble(double min, double max)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { static public Random random = new Random(); public static double randomDouble(double min, double max) { return Math.random() < 0.5 ? ((1 - Math.random()) * (max - min) + min) : (Math.random() * (max - min) + min); }//from w w w.j av a2s . c o m /** * Returns a random number between 0 (inclusive) and the specified value (inclusive). */ static public final int random(int range) { return random.nextInt(range + 1); } /** * Returns a random number between start (inclusive) and end (inclusive). */ static public final int random(int start, int end) { return start + random.nextInt(end - start + 1); } /** * Returns random number between 0.0 (inclusive) and 1.0 (exclusive). */ static public final float random() { return random.nextFloat(); } /** * Returns a random number between 0 (inclusive) and the specified value (exclusive). */ static public final float random(float range) { return random.nextFloat() * range; } /** * Returns a random number between start (inclusive) and end (exclusive). */ static public final float random(float start, float end) { return start + random.nextFloat() * (end - start); } }