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

chancesOffunction

The chance of each face of one die of a group, from its lowest face up. They sum to 1; a fair die's are all the same.

Import it

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

Definition

function chancesOf(group: DiceGroup): number[]

Parameters

NameTypeDescription
groupDiceGroup

One kind of dice and its rules.

Returns

number[]

The chance of each face of one die of a group, from its lowest face up. They sum to 1; a fair die's are all the same.

Examples

import { chancesOf } from "@johnmorrisdotca/korokoro";
import { normalizeSpec } from "@johnmorrisdotca/korokoro";
const spec = normalizeSpec({ count: 2, sides: 6 });
console.log(chancesOf(spec));
[
  0.16666666666666666,
  0.16666666666666666,
  0.16666666666666666,
  0.16666666666666666,
  0.16666666666666666,
  0.16666666666666666
]

What it prints (run when this page was built)

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