Here you can find the source of randomInRange(double min, double max)
public static double randomInRange(double min, double max)
//package com.java2s; //License from project: Open Source License public class Main { public static double randomInRange(double min, double max) { return Math.random() < 0.5 ? ((1 - Math.random()) * (max - min) + min) : (Math.random() * (max - min) + min); }//from www . ja v a 2s. co m }