< Dice
Difference between revisions of "Dice/Roller"
From DiceRoller Documentation
m (Skizzerz moved page API/Roller to Dice/Roller without leaving a redirect) |
m |
||
Line 2: | Line 2: | ||
Provides a Roll method to perform dice rolls. | Provides a Roll method to perform dice rolls. | ||
− | * '''Namespace:''' [[ | + | * '''Namespace:''' [[Dice]] |
* '''Assembly:''' DiceRoller (in DiceRoller.dll) | * '''Assembly:''' DiceRoller (in DiceRoller.dll) | ||
Line 19: | Line 19: | ||
! Name !! Description | ! Name !! Description | ||
|- | |- | ||
− | | {{static}} {{method}} || [[ | + | | {{static}} {{method}} || [[Dice/Roller/Roller|Roller()]] || Static constructor which initializes DefaultConfig. |
|} | |} | ||
Line 27: | Line 27: | ||
! Name !! Description | ! Name !! Description | ||
|- | |- | ||
− | | {{public}} {{static}} {{property}} || [[ | + | | {{public}} {{static}} {{property}} || [[Dice/Roller/DefaultConfig|DefaultConfig]] || Gets or sets the default roller configuration. |
|} | |} | ||
Line 35: | Line 35: | ||
! Name !! Description | ! Name !! Description | ||
|- | |- | ||
− | | {{public}} {{static}} {{method}} || [[ | + | | {{public}} {{static}} {{method}} || [[Dice/Roller/Roll|Roll(String, RollerConfig)]] || Rolls dice according to the string expression and an optional config. |
|} | |} | ||
Line 42: | Line 42: | ||
== Thread Safety == | == Thread Safety == | ||
− | The DefaultConfig property is not thread safe. Calling Roll with a {{cs|null}} [[ | + | The DefaultConfig property is not thread safe. Calling Roll with a {{cs|null}} [[Dice/RollerConfig|RollerConfig]] will make use of the DefaultConfig property. To be thread safe, call Roll with a RollerConfig that was created just for that thread. |
Revision as of 05:24, 9 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 | Roll(String, RollerConfig) | Rolls dice according to the string expression and an optional config. |
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.