diff --git a/src/main/java/com/samskivert/util/Randoms.java b/src/main/java/com/samskivert/util/Randoms.java index 6694cc21..630c25bb 100644 --- a/src/main/java/com/samskivert/util/Randoms.java +++ b/src/main/java/com/samskivert/util/Randoms.java @@ -93,6 +93,26 @@ public class Randoms return low + (_r.nextFloat() * (high - low)); } + /** + * Returns a pseudorandom, uniformly distributed double value between + * 0.0 (inclusive) and the high (exclusive). + * + * @param high the high value limiting the random number sought. + */ + public double getDouble (double high) + { + return _r.nextDouble() * high; + } + + /** + * Returns a pseudorandom, uniformly distributed double value between + * low (inclusive) and high (exclusive). + */ + public double getInRange (double low, double high) + { + return low + (_r.nextDouble() * (high - low)); + } + /** * Returns true approximately one in n times. *