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
| Name | Type | Description |
|---|---|---|
counts | readonly 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);trueWhat it prints (run when this page was built)