|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Die
public class Die
Die
- an n-sided die with given integer values. The given integer values are returned via nextRoll()
with uniform probability.,
Constructor Summary | |
---|---|
Die()
Creates a new Die instance with the default values: 1, 2, 3, 4, 5, 6. |
|
Die(int[] outcomes)
Creates a new Die instance with the given integer outcomes. |
|
Die(int sides,
int min)
Creates a new Die with a given number of sides and an incremental sequence of values beginning with a given minimum value. |
Method Summary | |
---|---|
int |
nextRoll()
nextRoll - return one of the die values at random. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Die(int[] outcomes)
Die
instance with the given integer outcomes.
outcomes
- an int[]
value - an array of the integer values for each side of the die.public Die(int sides, int min)
Die
with a given number of sides and an incremental sequence of values beginning with a given minimum value. Thus, the die is numbered min
, min + 1
, ... min + sides - 1
.
sides
- an int
value - number of sides on the diemin
- an int
value - minimum value of the incremental sequence of die valuespublic Die()
Die
instance with the default values: 1, 2, 3, 4, 5, 6.
Method Detail |
---|
public int nextRoll()
nextRoll
- return one of the die values at random. Each value is equiprobable.
int
value - die value rolled
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |