dX: Overengineered Dice Roller

Choose a die or dice to roll:

Or, “roll” your own using dX dice notation:

Then, see what comes out:

Rolling:
1d8
1-based
Rolled:
4

Random numbers are sourced from random.org.

dX Dice Notation

The notation dX uses is an extension of standard dice notation. The complete reference is divided into three sections below:

Constants & Dice Dice Modifiers Operators

42  4.2  0.42  .42 A numeric constant.
"Hello"  'Hello' A string constant.
NdX Roll N dice with X sides numbered 1 through X.
Nd% Roll N dice with 100 sides numbered 1 through 100.
NdX|Y Roll N dice with X sides numbered 1 through X/Y with Y sides of each value.
NdXZ Roll N dice with X sides numbered 0 through X-1.
Nd%Z Roll N dice with 100 sides numbered 0 through 99.
NdX|YZ Roll N dice with X sides numbered 0 through X/Y-1 with Y sides of each value.
NdF.1 Roll N FUDGE dice with 1 side worth +1, 1 side worth -1, and 4 sides worth 0.
NdF  NdF.2 Roll N FUDGE dice with 2 sides worth +1, 2 sides worth -1, and 2 sides worth 0.
NdF.3 Roll N FUDGE dice with 3 sides worth +1 and 3 sides worth -1.
NdP Roll N Poker dice with sides labeled 9, 10, J, Q, K, and A.
NdC Roll N Chess dice with sides labeled Pawn, Knight, Bishop, Rook, Queen, and King.
NdCA Roll N Crown & Anchor dice with sides labeled Crown, Anchor, Spade, Club, Diamond, and Heart.
Nd[Zodiac] Roll N Zodiac dice with sides labeled Aries through Pisces.
Nd[Planet] Roll N Planet dice with sides labeled Sun, Moon, Mercury through Pluto, Ascending Node, and Descending Node.
Nd{A₁,A₂,...,Aₓ} Roll N dice with X sides labeled A₁ through Aₓ.
Nd{A₁,A₂,...,Aₓ|D} Roll N dice with X sides labeled A₁ through Aₓ, delimited by D.
NdXu Make sure all rolled values are unique. N must be less than or equal to the number of faces. May precede the following.
NdXkY  NdXkYH Use only the Y highest values rolled.
NdXkYL Use only the Y lowest values rolled.
NdXkYC Use only Y of the values rolled, chosen randomly.
NdX-YH Subtract the Y highest values rolled. The H is required to differentiate from subtraction.
NdX-YL Subtract the Y lowest values rolled.
NdX-YC Subtract Y of the values rolled, chosen randomly.
NdX+YH Double-count the Y highest values rolled. The H is required to differentiate from addition.
NdX+YL Double-count the Y lowest values rolled.
NdX+YC Double-count Y of the values rolled, chosen randomly.
( expr ) Use parentheses to override operator precedence.
+ factor Unary plus.
- factor Negation.
# factor Turn factor into a number.
$ factor Turn factor into a string.
expr . expr String concatenation.
expr : expr String concatenation with spaces.
expr + expr Addition.
expr - expr Subtraction.
expr * expr Multiplication.
expr / expr Division.
expr \ expr Integer division.
expr % expr Modulus.
expr x expr Repetition.

dX API

To use dX in your own application, simply make a GET or POST request to this page (http://www.kreativekorp.com/dX/) with the following parameters:

Parameter Req/Opt Value Description
roll required any valid string The dice expression to roll.
format required php Produce output in the format of PHP's print_r() function.
json Produce output as a JSON array.
xml Produce output as an XML property list.
html Produce the rendered HTML without any boilerplate.
result-strings Produce only the results of each roll in plain text.
optimize optional 1truetyesyon Simplify expressions after parsing.
0falsefnonoff Keep expressions exactly as parsed.
evaluate optional 1truetyesyon Return calculated results for every expression.
0falsefnonoff Only return the syntax tree; do not return results.
expound optional 1truetyesyon Return the entire syntax tree.
0falsefnonoff Only return results; do not return the syntax tree.
debug optional 0falsefnonoff Normal operation.
1truetyesyon Returns the syntax tree as parsed, as parsed with results, simplified, and simplified with results. Overrides the settings of optimize, evaluate, and expound. Also, the PRNG is seeded so that both original and simplified expressions return the same results.