Reference · Rolls and exact odds
rollPresetfunction
Throw a game's dice and read them. source is the crypto generator unless
a seeded one is given; before is the rolls so far in the same game.
Throws a RangeError for a name that is no preset.
Import it
import { rollPreset } from "@johnmorrisdotca/korokoro";
Definition
function rollPreset(name: string, options?: { source?: RandomSource; at?: number; before?: readonly Roll[]; language?: "en" | "ja"; }): PresetRoll
Parameters
| Name | Type | Description |
|---|---|---|
name | string | The preset or saved-set name to look up or write. |
options (optional) | { source?: RandomSource; at?: number; before?: readonly Roll[]; language?: "en" | "ja"; } | Options for this call; omitted fields keep their documented defaults. |
Returns
PresetRoll
Throw a game's dice and read them. source is the crypto generator unless a seeded one is given; before is the rolls so far in the same game. Throws a RangeError for a name that is no preset.
Examples
import { rollPreset } from "@johnmorrisdotca/korokoro";
import { seededSource } from "@johnmorrisdotca/korokoro";
console.log(rollPreset("cho-han", { source: seededSource("table"), at: 0 }).reading.text);Han: 3 is oddWhat it prints (run when this page was built)