|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jbergin.util.Die
public class Die
Represents a single Die that you can "roll" to get a random int. Unlike a standard die, these can have any number of "faces", even if that would be a physical impossibility. The random numbers generated are approximately uniform.
Constructor Summary | |
---|---|
Die(int faces)
Create a die with any number of faces. |
Method Summary | |
---|---|
int |
faces()
Learn the number of faces on this die. |
static int |
mostRecent()
Roll the most recently created die and return the result |
int |
roll()
get a random number in the range [1..faces] inclusive. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Die(int faces)
faces
- the number of faces on the dieMethod Detail |
---|
public static final int mostRecent()
public int roll()
public int faces()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |