Here you can find the source of randomFloat(float min, float max)
public static float randomFloat(float min, float max)
//package com.java2s; /**/*from w w w . j a v a 2 s . c o m*/ * Project: warnme-server * File: RandomUtils.java * License: * This file is licensed under GNU General Public License version 3 * http://www.gnu.org/licenses/gpl-3.0.txt * * Copyright: Bartosz Cichecki [ cichecki.bartosz@gmail.com ] * Date: Apr 24, 2014 */ import java.text.DecimalFormat; public class Main { public static float randomFloat(float min, float max) { Float f = (float) (min + Math.random() * (max - min + 1)); return Float.valueOf(new DecimalFormat("#.##").format(f)); } }