Reference · Rolls and exact odds
mathRangefunction
The least and the most a sound formula can come to, given each kind's range.
Import it
import { mathRange } from "@johnmorrisdotca/korokoro";
Definition
function mathRange(node: MathNode, ranges: readonly { min: number; max: number; }[]): { min: number; max: number; }
Parameters
| Name | Type | Description |
|---|---|---|
node | MathNode | The arithmetic expression tree. |
ranges | readonly { min: number; max: number; }[] | The minimum and maximum for each dice group. |
Returns
{ min: number; max: number; }
The least and the most a sound formula can come to, given each kind's range.
Examples
import { mathRange } from "@johnmorrisdotca/korokoro";
console.log(mathRange({ kind: "dice", group: 0 }, [{ min: 1, max: 6 }]));{ min: 1, max: 6 }What it prints (run when this page was built)