Added getInt(high, low).

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2583 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2003-05-16 02:21:37 +00:00
parent 54b02327c1
commit 2f166d2bb1
+10 -1
View File
@@ -1,5 +1,5 @@
//
// $Id: RandomUtil.java,v 1.7 2003/03/18 19:38:30 ray Exp $
// $Id: RandomUtil.java,v 1.8 2003/05/16 02:21:37 ray Exp $
package com.threerings.util;
@@ -28,6 +28,15 @@ public class RandomUtil
return rand.nextInt(high);
}
/**
* Returns a pseudorandom, uniformly distributed <code>int</code>
* value between <code>high</code> and <code>low</code>, exclusive of each.
*/
public static int getInt (int high, int low)
{
return low + 1 + rand.nextInt(high - low - 1);
}
/**
* Returns a pseudorandom, uniformly distributed float value between
* 0.0 (inclusive) and the specified value (exclusive).