RogueSharp
Show / Hide Table of Contents

Class Dice

The Dice class is a static class that has convenience methods for parsing and rolling dice

Inheritance
System.Object
Dice
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: RogueSharp.DiceNotation
Assembly: RogueSharp.dll
Syntax
public static class Dice

Methods

| Improve this Doc View Source

Parse(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

| Improve this Doc View Source

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

| Improve this Doc View Source

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

  • Improve this Doc
  • View Source
RogueSharp © 2014-2020 Faron Bracy
Back to top