|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.croftsoft.core.math.RandomLib
public class RandomLib
Random number generation methods.
Constructor Summary | |
---|---|
RandomLib()
|
Method Summary | |
---|---|
static void |
main(String[] args)
Test method; prints roll(arg0, arg1, arg2). |
static long |
nextLong(long n)
Returns a long between 0 (inclusive) and n (exclusive). |
static long |
roll(long multiplier,
long base,
long offset)
Rolls an n-sided die a specified number of times and adds an offset. |
static double |
uniform(double min,
double max)
Returns a double uniformly distributed between min (inclusive) and max (exclusive). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomLib()
Method Detail |
---|
public static void main(String[] args)
public static long nextLong(long n)
IllegalArgumentException
- If n is negative.public static long roll(long multiplier, long base, long offset)
multiplier
- The number of times to roll the die. Must be non-negative.base
- The number of sides on the die, e.g., six.offset
- A final adjustment to add to the sum after all rolls have been
made.
public static double uniform(double min, double max)
|
CroftSoft Javadoc | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |