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

readSharedManyfunction

A shared set of rolls from a query string, or null when it does not hold one: as many rolls as the notation's # says, each with faces its dice could show.

Import it

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

Definition

function readSharedMany(query: string | URLSearchParams): Roll[] | null

Parameters

NameTypeDescription
querystring | URLSearchParams

A query string or URLSearchParams containing the shared settings.

Returns

Roll[] | null

A shared set of rolls from a query string, or null when it does not hold one: as many rolls as the notation's # says, each with faces its dice could show.

Examples

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

What it prints (run when this page was built)

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