Interface IDie

Namespace
Wolfgang.D20
Assembly
Wolfgang.D20.Dice.dll

Represents a single die with a fixed number of sides.

public interface IDie
Extension Methods

Examples

IDie die = new Die(20);
int result = die.Roll(); // a value in [1, 20]

Properties

MaxValue

The maximum value that can be rolled on the die. Equal to SideCount.

int MaxValue { get; }

Property Value

int

MinValue

The minimum value that can be rolled on the die. Always 1.

int MinValue { get; }

Property Value

int

SideCount

The number of sides on the die. Must be at least 2.

int SideCount { get; }

Property Value

int

Remarks

A value of 2 represents a coin toss, 3 represents a three-sided die, etc.

Methods

Roll()

Rolls the die and returns the value rolled.

int Roll()

Returns

int

A uniform random value in [MinValue, MaxValue] inclusive.

ToString()

Returns a string representation of the die in the format "dY" where Y is the number of sides.

string ToString()

Returns

string

The die in standard dY notation.