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

fairnessTestfunction

Is this die fair? A chi-square goodness-of-fit test of how often each face came up (counts[i] for the i-th face) against a fair die, or against chances when the die is supposed to be something else. It makes no roll: the counts can come from a history here or from a real die on a real table.

Import it

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

Definition

function fairnessTest(counts: readonly number[], chances?: readonly number[]): Fairness

Parameters

NameTypeDescription
countsreadonly number[]

Observed counts in face order.

chances (optional)readonly number[] | undefined

Expected face probabilities; uniform when omitted.

Returns

Fairness

Is this die fair? A chi-square goodness-of-fit test of how often each face came up (counts[i] for the i-th face) against a fair die, or against chances when the die is supposed to be something else. It makes no roll: the counts can come from a history here or from a real die on a real table.

Examples

import { fairnessTest } from "@johnmorrisdotca/korokoro";
console.log(fairnessTest([30, 30, 30, 30, 30, 30]).enough);
true

What it prints (run when this page was built)

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