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

distributionOffunction

Every total a spec can make and its chance. Several kinds of dice are independent, so their totals are put together by convolution: every pair of totals, their chances multiplied. Worked out once for each spec, then remembered.

Import it

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

Definition

function distributionOf(spec: RollSpec): Distribution

Parameters

NameTypeDescription
specRollSpec

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

Returns

Distribution

Every total a spec can make and its chance. Several kinds of dice are independent, so their totals are put together by convolution: every pair of totals, their chances multiplied. Worked out once for each spec, then remembered.

Examples

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

What it prints (run when this page was built)

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