java.lang.ObjectDie
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 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Die(int faces)
faces - the number of faces on the die| Method Detail |
|---|
public int faces()
public static final int mostRecent()
public int roll()