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

FaceStatstype

How often each face of one kind of die came up, and whether that looks fair.

Import it

import type { FaceStats } from "@johnmorrisdotca/korokoro";

Definition

type FaceStats = {
    sides: Sides;
    counts: number[];
    dice: number;
    fairness: number | null;
    labels?: string[];
    loaded?: true;
};

Members

NameTypeDescription
sidesSides

The kind of die counted.

countsnumber[]

counts[i] is how often the die's i-th face came up, from its lowest: every die thrown, a rerolled one and an explosion's included.

dicenumber

How many dice of this kind were thrown.

fairnessnumber | null

Chance a fair die strays this far or further. Null until there are enough throws to ask.

labels (optional)string[] | undefined

What each face says, on a custom die. Left out otherwise.

loaded (optional)true | undefined

True when the die counted is a loaded one. Left out otherwise.

Examples

import type { FaceStats } from "@johnmorrisdotca/korokoro";
import { faceStats } from "@johnmorrisdotca/korokoro";
const value: FaceStats = faceStats([], 6);
console.log(value.counts);
[ 0, 0, 0, 0, 0, 0 ]

What it prints (run when this page was built)

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