Reference · Rolls and exact odds
rangeOffunction
The lowest and highest totals a spec can produce. An exploding die's highest is every explosion it is allowed.
Import it
import { rangeOf } from "@johnmorrisdotca/korokoro";
Definition
function rangeOf(spec: RollSpec): { min: number; max: number; }
Parameters
| Name | Type | Description |
|---|---|---|
spec | RollSpec | Dice counts, sides, rules and modifier; omitted fields use the documented defaults. |
Returns
{ min: number; max: number; }
The lowest and highest totals a spec can produce. An exploding die's highest is every explosion it is allowed.
Examples
import { rangeOf } from "@johnmorrisdotca/korokoro";
import { normalizeSpec } from "@johnmorrisdotca/korokoro";
const spec = normalizeSpec({ count: 2, sides: 6 });
console.log(rangeOf(spec));{ min: 2, max: 12 }What it prints (run when this page was built)