Reference · Rolls and exact odds
FaceStatstype
How often each face of one kind of die came up, and whether that looks fair.
Import it
import type { FaceStats } from "@johnmorrisdotca/korokoro";
Definition
type FaceStats = {
sides: Sides;
counts: number[];
dice: number;
fairness: number | null;
labels?: string[];
loaded?: true;
};
Members
| Name | Type | Description |
|---|---|---|
sides | Sides | The kind of die counted. |
counts | number[] | counts[i] is how often the die's i-th face came up, from its lowest: every die thrown, a rerolled one and an explosion's included. |
dice | number | How many dice of this kind were thrown. |
fairness | number | null | Chance a fair die strays this far or further. Null until there are enough throws to ask. |
labels (optional) | string[] | undefined | What each face says, on a custom die. Left out otherwise. |
loaded (optional) | true | undefined | True when the die counted is a loaded one. Left out otherwise. |
Examples
import type { FaceStats } from "@johnmorrisdotca/korokoro";
import { faceStats } from "@johnmorrisdotca/korokoro";
const value: FaceStats = faceStats([], 6);
console.log(value.counts);[ 0, 0, 0, 0, 0, 0 ]What it prints (run when this page was built)