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

SoundThrowtype

The sound of a roll: a shake while the dice tumble and a knock as each one lands. The recordings are real dice (see SOUNDS.md), loaded the first time a tray with its sound on rolls and never before, so a page that stays silent never fetches them. Where they cannot be loaded or decoded, a short knock made in the browser stands in. Nothing here throws: a platform with no audio, a blocked context or a failed decode is simply silent.

Import it

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

Definition

type SoundThrow = {
    dice: number;
    ms: number;
    landings: number[];
};

Members

NameTypeDescription
dicenumber

How many dice were thrown.

msnumber

How long the tumble lasts, in milliseconds. Nought when the dice land at once.

landingsnumber[]

When each die lands, in milliseconds from the throw, in the order thrown.

Examples

import type { SoundThrow } from "@johnmorrisdotca/korokoro";
const value: SoundThrow = { dice: 2, ms: 300, landings: [150, 300] };
console.log(value.landings);
[ 150, 300 ]

What it prints (run when this page was built)

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