Skip to content

Randsum Dice Notation Spec

RANDSUM uses an extended version of standard dice notation. All notation is case-insensitive (2d8 = 2D8).

The core format is NdS where N is the number of dice and S is the number of sides.

Add or subtract a fixed value from the total.

NotationDescription
+NAdd N to total
-NSubtract N from total

Remove dice from the result pool.

NotationDescription
LDrop lowest 1
L2Drop lowest 2
HDrop highest 1
H2Drop highest 2
D{>N}Drop rolls over N
D{>=N}Drop rolls at or over N
D{<N}Drop rolls under N
D{<=N}Drop rolls at or under N
D{X,Y}Drop exact values X and Y

Keep specific dice from the result (complement of drop).

NotationDescription
KKeep highest 1
K3Keep highest 3
klKeep lowest 1
kl2Keep lowest 2

Limit roll values to a specific range.

NotationDescription
C{>N}Cap rolls over N to N
C{<N}Cap rolls under N to N
C{<N,>M}Cap both ends

Reroll dice matching certain conditions.

NotationDescription
R{>N}Reroll results over N
R{>=N}Reroll results at or over N
R{<N}Reroll results under N
R{<=N}Reroll results at or under N
R{X,Y}Reroll exact values X, Y
R{<N}MReroll under N, max M attempts

Replace specific results with new values.

NotationDescription
V{X=Y}Replace Xs with Y
V{>N=Y}Replace results over N with Y
V{<N=Y}Replace results under N with Y

Force all dice in a pool to show different values.

NotationDescription
UAll results must be unique
U{X,Y}Unique except X and Y can repeat

Roll additional dice when a die shows its maximum value.

NotationDescription
!Explode: one additional die per max result (single pass)

When a die shows its maximum value, it “explodes” — one new die is rolled and added to the result. This is a single pass: the newly added dice are not checked for further explosions. For recursive explosions, use compound (!!) or penetrate (!p).

Example: 3d6! rolls [6, 4, 6]. The two 6s explode, adding [5, 3]. Final result: [6, 4, 6, 5, 3] = 24.

Exploding dice that add to the triggering die instead of creating new dice.

NotationDescription
!!Compound once per die
!!NCompound with max depth N
!!0Compound unlimited (capped at 1000)

Example: 1d6!! rolls 6. This compounds, rolling 4. The die value becomes 6 + 4 = 10. Unlike regular exploding, this does not create new dice — it modifies the existing die.

Difference from explode:

  • Explode (!): Creates new dice — [6, 4, 6] becomes [6, 4, 6, 5, 3] (5 dice)
  • Compound (!!): Modifies existing die — [6, 4, 6] becomes [15, 4, 12] (still 3 dice)

Exploding dice where each subsequent explosion subtracts 1 (Hackmaster-style).

NotationDescription
!pPenetrate once per die
!pNPenetrate with max depth N
!p0Penetrate unlimited (capped at 1000)

Example: 1d6!p rolls 6. This penetrates, rolling 5. The value added is 5 - 1 = 4, so the die becomes 6 + 4 = 10.

Multiply the dice sum before adding/subtracting arithmetic modifiers.

NotationDescription
*NMultiply dice sum by N

Example: 2d6*2+3 rolls [4, 5] = 9. Multiplied by 2 = 18. Plus 3 = 21.

Count dice meeting a threshold instead of summing values. Used in dice pool systems.

NotationDescription
S{N}Count dice >= N
S{N,B}Count successes >= N, subtract botches <= B

Example: 5d10S{7} rolls [8, 3, 10, 6, 9]. Successes >= 7: [8, 10, 9] = 3 successes.

Multiply the entire final total after all other modifiers.

NotationDescription
**NMultiply final total by N

Difference from pre-arithmetic multiplier:

  • Pre-arithmetic (*): 2d6*2+3 = (sum x 2) + 3
  • Total (**): 2d6+3**2 = (sum + 3) x 2

Modifiers can be chained together. They are applied in a fixed priority order:

PriorityModifierNotationDescription
10CapC{...}Limit roll values to a range
20DropH, LRemove dice from pool
21KeepK, klKeep dice in pool
30ReplaceV{...}Replace specific values
40RerollR{...}Reroll dice matching conditions
50Explode!Roll additional dice on max
51Compound!!Add explosion to existing die
52Penetrate!pAdd explosion minus 1 to die
60UniqueUEnsure no duplicate values
85Multiply*NMultiply dice sum (pre-arithmetic)
90Plus+NAdd to total
91Minus-NSubtract from total
95Count SuccessesS{...}Count dice meeting threshold
100Total Multiply**NMultiply entire final total

Roll different dice types in a single expression:

import { roll } from '@randsum/roller'
// Attack roll + damage
roll('1d20+5', '2d6+3')
// Subtract a die group
roll('2d12-1d6') // Roll 2d12, subtract 1d6