From 5deda8b1f834c0945259b40c9fc1a88883da07f8 Mon Sep 17 00:00:00 2001 From: Walter Korman Date: Tue, 15 Jan 2002 18:05:01 +0000 Subject: [PATCH] Added getFloat(). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@855 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/util/RandomUtil.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/util/RandomUtil.java b/src/java/com/threerings/util/RandomUtil.java index b913bd664..f2cd322a4 100644 --- a/src/java/com/threerings/util/RandomUtil.java +++ b/src/java/com/threerings/util/RandomUtil.java @@ -1,5 +1,5 @@ // -// $Id: RandomUtil.java,v 1.2 2001/12/14 16:46:01 shaper Exp $ +// $Id: RandomUtil.java,v 1.3 2002/01/15 18:05:01 shaper Exp $ package com.threerings.media.util; @@ -24,6 +24,15 @@ public class RandomUtil return _rnd.nextInt(high); } + /** + * Returns a pseudorandom, uniformly distributed float value between + * 0.0 (inclusive) and the specified value (inclusive). + */ + public static float getFloat (float high) + { + return _rnd.nextFloat() * high; + } + /** The random object from which we choose random numbers. */ protected static Random _rnd = new Random(); }