Class Die

java.lang.Object
  extended by Die

public class Die
extends java.lang.Object

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

Die

public Die(int[] outcomes)
Creates a new Die instance with the given integer outcomes.

Parameters:
outcomes - an int[] value - an array of the integer values for each side of the die.

Die

public 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. Thus, the die is numbered min, min + 1, ... min + sides - 1.

Parameters:
sides - an int value - number of sides on the die
min - an int value - minimum value of the incremental sequence of die values

Die

public Die()
Creates a new Die instance with the default values: 1, 2, 3, 4, 5, 6.

Method Detail

nextRoll

public int nextRoll()
nextRoll - return one of the die values at random. Each value is equiprobable.

Returns:
an int value - die value rolled