Here you can find the source of getRandomDouble(double max, String decimalFormat)
public static double getRandomDouble(double max, String decimalFormat)
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; public class Main { public static double getRandomDouble(double max, String decimalFormat) { DecimalFormat formatter = new DecimalFormat(decimalFormat); return Double.parseDouble(formatter.format(Math.random() * max)); }//from w w w . j av a 2s .c om }