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

Fairnesstype

What a fairness test makes of a die.

Import it

import type { Fairness } from "@johnmorrisdotca/korokoro";

Definition

type Fairness = {
    sides: number;
    rolls: number;
    minimum: number;
    enough: boolean;
    expected: number[];
    statistic: number | null;
    p: number | null;
    verdict: "too-few" | "fair" | "unusual" | "lopsided";
};

Members

NameTypeDescription
sidesnumber

How many faces the die has.

rollsnumber

How many throws were counted.

minimumnumber

How many throws the test wants before it will pronounce: five for each face.

enoughboolean

Whether there were that many.

expectednumber[]

How often each face should have come up, if the die is what it is tested against.

statisticnumber | null

The chi-square statistic: how far the counts stray from that, in all. Null with too few throws.

pnumber | null

The chance that a die as supposed strays this far or further. Null with too few throws: never a guess.

verdict"fair" | "too-few" | "unusual" | "lopsided"

The reading. too-few: no verdict. fair: nothing to see (p of 5% or more). unusual: lopsided enough to happen less than one time in twenty by chance, which still happens one time in twenty. lopsided: less than one time in a thousand.

Examples

import type { Fairness } from "@johnmorrisdotca/korokoro";
import { fairnessTest } from "@johnmorrisdotca/korokoro";
const value: Fairness = fairnessTest([30, 30, 30, 30, 30, 30]);
console.log(value.enough);
true

What it prints (run when this page was built)

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