< Dice
Difference between revisions of "Dice/Roller"
From DiceRoller Documentation
Line 34: | Line 34: | ||
! Name !! Description | ! Name !! Description | ||
|- | |- | ||
− | | {{ | + | | {{internal}} {{static}} {{method}} || [[/Parse|Parse(String, RollerConfig)]] || Parses the diceExpr into an AST without evaluating it. |
|- | |- | ||
− | | {{public}} {{static}} {{method}} || [[ | + | | {{public}} {{static}} {{method}} || [[/Roll (String)|Roll(String)]] || Rolls dice according to the string expression, using the default configuration. |
+ | |- | ||
+ | | {{public}} {{static}} {{method}} || [[/Roll (String, RollerConfig)|Roll(String, RollerConfig)]] || Rolls dice according to the string expression and configuration. | ||
+ | |- | ||
+ | | {{internal}} {{static}} {{method}} || [[/Roll (DiceAST, RollerConfig)|Roll(DiceAST, RollerConfig)]] || Evaluates the root of the tree, returning the RollResult. | ||
|} | |} | ||
Revision as of 18:52, 20 April 2017
Provides a Roll method to perform dice rolls.
- Namespace: Dice
- Assembly: DiceRoller (in DiceRoller.dll)
Inheritance Hierarchy
System.Object
- Dice.Roller
Syntax
public static class Roller
Constructors
Name | Description | |
---|---|---|
S | Roller() | Static constructor which initializes DefaultConfig. |
Properties
Name | Description | |
---|---|---|
S | DefaultConfig | Gets or sets the default roller configuration. |
Methods
Name | Description | |
---|---|---|
S | Parse(String, RollerConfig) | Parses the diceExpr into an AST without evaluating it. |
S | Roll(String) | Rolls dice according to the string expression, using the default configuration. |
S | Roll(String, RollerConfig) | Rolls dice according to the string expression and configuration. |
S | Roll(DiceAST, RollerConfig) | Evaluates the root of the tree, returning the RollResult. |
Remarks
The Roller class is the main entry point to the library, and allows you to roll dice according to a given dice expression. To customize various aspects of a roll, a configuration can be passed in.
Thread Safety
The DefaultConfig property is not thread safe. Calling Roll with a null
RollerConfig will make use of the DefaultConfig property. To be thread safe, call Roll with a RollerConfig that was created just for that thread.