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

distributionHoldingfunction

The odds of a roll with some of its dice held: the held faces are settled, and only the rest are still to be thrown. held[i] is whether face i is held. With every die held there is one total, and it is certain. A RangeError for dice that cannot be held (canHold).

Import it

import { distributionHolding } from "@johnmorrisdotca/korokoro";

Definition

function distributionHolding(spec: RollSpec, faces: readonly number[], held: readonly boolean[]): Distribution

Parameters

NameTypeDescription
specRollSpec

Dice counts, sides, rules and modifier; omitted fields use the documented defaults.

facesreadonly number[]

Physical face values, in the order thrown.

heldreadonly boolean[]

A mask marking dice whose faces stay fixed.

Returns

Distribution

The odds of a roll with some of its dice held: the held faces are settled, and only the rest are still to be thrown. held[i] is whether face i is held. With every die held there is one total, and it is certain. A RangeError for dice that cannot be held (canHold).

Examples

import { distributionHolding } from "@johnmorrisdotca/korokoro";
import { normalizeSpec } from "@johnmorrisdotca/korokoro";
const spec = normalizeSpec({ count: 2, sides: 6 });
const odds = distributionHolding(spec, [6, 3], [true, false]);
console.log(odds.min, odds.max);
7 12

What it prints (run when this page was built)

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