Here you can find the source of random()
public static double random()
//package com.java2s; //License from project: Open Source License public class Main { public static double random() { return Math.random(); }/*from w w w .j a v a2 s . c o m*/ public static double random(double from, double to) { return (to - from) * Math.random() + from; } }