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

rollPresetfunction

Throw a game's dice and read them. source is the crypto generator unless a seeded one is given; before is the rolls so far in the same game. Throws a RangeError for a name that is no preset.

Import it

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

Definition

function rollPreset(name: string, options?: { source?: RandomSource; at?: number; before?: readonly Roll[]; language?: "en" | "ja"; }): PresetRoll

Parameters

NameTypeDescription
namestring

The preset or saved-set name to look up or write.

options (optional){ source?: RandomSource; at?: number; before?: readonly Roll[]; language?: "en" | "ja"; }

Options for this call; omitted fields keep their documented defaults.

Returns

PresetRoll

Throw a game's dice and read them. source is the crypto generator unless a seeded one is given; before is the rolls so far in the same game. Throws a RangeError for a name that is no preset.

Examples

import { rollPreset } from "@johnmorrisdotca/korokoro";
import { seededSource } from "@johnmorrisdotca/korokoro";
console.log(rollPreset("cho-han", { source: seededSource("table"), at: 0 }).reading.text);
Han: 3 is odd

What it prints (run when this page was built)

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