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

readSharedfunction

A shared roll from a query string, or null when it does not describe one this roller could have thrown.

Import it

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

Definition

function readShared(query: string | URLSearchParams): Roll | null

Parameters

NameTypeDescription
querystring | URLSearchParams

A query string or URLSearchParams containing the shared settings.

Returns

Roll | null

A shared roll from a query string, or null when it does not describe one this roller could have thrown.

Examples

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

What it prints (run when this page was built)

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