|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jtge.util.random.Dice
Emulates a dice.
A dice is defined by :
Example : 2d8+3 stands for 2 dices of type 8 with a bonus of 3.
Constructor Summary | |
Dice(int number,
int type)
Create a dice out of the number of dices and a type (e.g. no bonus). |
|
Dice(int number,
int type,
int bonus)
Create a dice out of the number of dices, the type and the bonus value. |
|
Dice(java.lang.String definition)
Create a dice from a textual definition. |
Method Summary | |
int |
roll()
Roll the dice. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Dice(int number, int type, int bonus)
Number and type must be positive.
number
- the number of rollstype
- the type of dicebonus
- the number added to the resultpublic Dice(int number, int type)
Number and type must be positive.
number
- the number of rollstype
- the type of dicepublic Dice(java.lang.String definition)
The expected format is : {diceNumber}d{diceType}+{bonus}.
definition
- the definition.Method Detail |
public final int roll()
public final java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |