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

rollManyfunction

Throw the same dice several times in one go, as ability scores are rolled: 4d6dl1 six times. The rolls are drawn one after another from the one source, so a seed replays the whole set, and each is an ordinary roll that says which set it belongs to. times is the spec's own unless given, from 1 to MAX_TIMES.

Import it

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

Definition

function rollMany(spec: Partial<RollSpec>, times?: number, source?: RandomSource, when?: number | RollOptions): RollSet

Parameters

NameTypeDescription
specPartial<RollSpec>

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

times (optional)number | undefined

The number of independent repeats.

source (optional)RandomSource

A source of unsigned 32-bit integers; crypto by default where optional.

when (optional)number | RollOptions

Epoch milliseconds, or roll options including the time and maximum dice.

Returns

RollSet

Throw the same dice several times in one go, as ability scores are rolled: 4d6dl1 six times. The rolls are drawn one after another from the one source, so a seed replays the whole set, and each is an ordinary roll that says which set it belongs to. times is the spec's own unless given, from 1 to MAX_TIMES.

Examples

import { rollMany } from "@johnmorrisdotca/korokoro";
import { normalizeSpec, seededSource } from "@johnmorrisdotca/korokoro";
const spec = normalizeSpec({ count: 2, sides: 6 });
console.log(rollMany(spec, 3, seededSource("table"), 0).rolls.length);
3

What it prints (run when this page was built)

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