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:
@@ -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;
|
package com.threerings.util;
|
||||||
|
|
||||||
@@ -28,6 +28,15 @@ public class RandomUtil
|
|||||||
return rand.nextInt(high);
|
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
|
* Returns a pseudorandom, uniformly distributed float value between
|
||||||
* 0.0 (inclusive) and the specified value (exclusive).
|
* 0.0 (inclusive) and the specified value (exclusive).
|
||||||
|
|||||||
Reference in New Issue
Block a user