Reference · Rolls and exact odds
chanceExactlyfunction
The chance of exactly this total.
Import it
import { chanceExactly } from "@johnmorrisdotca/korokoro";
Definition
function chanceExactly(spec: Odds, total: number): number
Parameters
| Name | Type | Description |
|---|---|---|
spec | Odds | Dice counts, sides, rules and modifier; omitted fields use the documented defaults. |
total | number | The total to measure or compare. |
Returns
number
The chance of exactly this total.
Examples
import { chanceExactly } from "@johnmorrisdotca/korokoro";
import { normalizeSpec } from "@johnmorrisdotca/korokoro";
const spec = normalizeSpec({ count: 2, sides: 6 });
console.log(chanceExactly(spec, 7));0.16666666666666666What it prints (run when this page was built)