Skip to the content

Korokoroコロコロ

Roll mixed dice or type notation, compare exact probabilities, keep a history and replay seeded rolls.

Korokoro describes something small rolling in Japanese. About the name

Contents

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

NameTypeDescription
nodeMathNode

The arithmetic expression tree.

rangesreadonly { 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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/korokoro 1.16.0.