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