Reference · Rolls and exact odds
loadedWeightsfunction
A loaded die's weights, checked and in lowest terms: one whole number from
0 to MAX_WEIGHT for each face, at least two faces that can come up.
Undefined when they are not sound, and also when every face weighs the
same, which is a fair die and must not be called loaded.
Import it
import { loadedWeights } from "@johnmorrisdotca/korokoro";
Definition
function loadedWeights(sides: Sides, weights: unknown): number[] | undefined
Parameters
| Name | Type | Description |
|---|---|---|
sides | Sides | A numbered die size or F for Fate dice. |
weights | unknown | One integer weight per physical face. |
Returns
number[] | undefined
A loaded die's weights, checked and in lowest terms: one whole number from 0 to MAX_WEIGHT for each face, at least two faces that can come up. undefined when they are not sound, and also when every face weighs the same, which is a fair die and must not be called loaded.
Examples
import { loadedWeights } from "@johnmorrisdotca/korokoro";
console.log(loadedWeights(6, [1, 1, 1, 1, 1, 3]));[ 1, 1, 1, 1, 1, 3 ]What it prints (run when this page was built)