Class Dice
The Dice class is a static class that has convenience methods for parsing and rolling dice
Inheritance
Inherited Members
Namespace: RogueSharp.DiceNotation
Assembly: RogueSharp.dll
Syntax
public static class Dice
Methods
| Improve this Doc View SourceParse(String)
Parse the specified string into a DiceExpression
Declaration
public static DiceExpression Parse(string expression)
Parameters
Type | Name | Description |
---|---|---|
System.String | expression | The string dice expression to parse. Ex. 3d6+4 |
Returns
Type | Description |
---|---|
DiceExpression | A DiceExpression representing the parsed string |
Roll(String)
A convenience method for parsing a dice expression from a string, rolling the dice, and returning the total.
Declaration
public static int Roll(string expression)
Parameters
Type | Name | Description |
---|---|---|
System.String | expression | The string dice expression to parse. Ex. 3d6+4 |
Returns
Type | Description |
---|---|
System.Int32 | An integer result of the sum of the dice rolled including constants and scalars in the expression |
Remarks
Uses DotNetRandom as its RNG
Roll(String, IRandom)
A convenience method for parsing a dice expression from a string, rolling the dice, and returning the total.
Declaration
public static int Roll(string expression, IRandom random)
Parameters
Type | Name | Description |
---|---|---|
System.String | expression | The string dice expression to parse. Ex. 3d6+4 |
IRandom | random | IRandom RNG used to perform the Roll. |
Returns
Type | Description |
---|---|
System.Int32 | An integer result of the sum of the dice rolled including constants and scalars in the expression |