tapestry.support.util
Class Dice

java.lang.Object
  |
  +--tapestry.support.util.Dice

public class Dice
extends java.lang.Object

A class for simulating a die, i.e., an object "rolled" to generate a random number between 1 and the number of sides.


Constructor Summary
Dice(int numSides)
          Creates a single die with the number of sides specified by numSides (e.g., 2 is a coin, 6 is a cubed die).
 
Method Summary
 int getNumRolls()
          Returns the number of times roll() has been called for a specific dice.
 int getNumSides()
          Returns the number of sides for a specific dice.
 int roll()
          Returns the random "roll" of the die, a uniformly distributed random number between 1 and numSides.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dice

public Dice(int numSides)
Creates a single die with the number of sides specified by numSides (e.g., 2 is a coin, 6 is a cubed die).
Parameters:
numSides - number of sides on die
Method Detail

roll

public int roll()
Returns the random "roll" of the die, a uniformly distributed random number between 1 and numSides.

getNumRolls

public int getNumRolls()
Returns the number of times roll() has been called for a specific dice.

getNumSides

public int getNumSides()
Returns the number of sides for a specific dice.