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

totalStatsfunction

The totals of every roll of one spec in a history, beside what the odds expect.

Import it

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

Definition

function totalStats(history: readonly Roll[], spec: RollSpec): TotalStats

Parameters

NameTypeDescription
historyreadonly Roll[]

Completed rolls, newest first where the history API requires it.

specRollSpec

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

Returns

TotalStats

The totals of every roll of one spec in a history, beside what the odds expect.

Examples

import { totalStats } from "@johnmorrisdotca/korokoro";
import { normalizeSpec, rollFrom } from "@johnmorrisdotca/korokoro";
const spec = normalizeSpec({ count: 2, sides: 6 });
const sample = rollFrom(spec, [2, 5], "saved", 0, null)!;
console.log(totalStats([sample], spec)?.average);
7

What it prints (run when this page was built)

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