本文へ移動

Korokoroコロコロ

ダイスを組み合わせて振り、ダイス表記を読み取り、正確な確率を調べます。履歴の保存やシードを指定した再現もできます。

「コロコロ」は、小さなものが転がる様子を表す言葉です。 名前について(英語)

目次

リファレンス · ロールと正確な確率

rollMany関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

Throw the same dice several times in one go, as ability scores are rolled: 4d6dl1 six times. The rolls are drawn one after another from the one source, so a seed replays the whole set, and each is an ordinary roll that says which set it belongs to. times is the spec's own unless given, from 1 to MAX_TIMES.

インポート

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

定義

function rollMany(spec: Partial<RollSpec>, times?: number, source?: RandomSource, when?: number | RollOptions): RollSet

引数

名前型説明
specPartial<RollSpec>

Dice counts, sides, rules and modifier; omitted fields use the documented defaults.

times (省略可)number | undefined

The number of independent repeats.

source (省略可)RandomSource

A source of unsigned 32-bit integers; crypto by default where optional.

when (省略可)number | RollOptions

Epoch milliseconds, or roll options including the time and maximum dice.

戻り値

RollSet

Throw the same dice several times in one go, as ability scores are rolled: 4d6dl1 six times. The rolls are drawn one after another from the one source, so a seed replays the whole set, and each is an ordinary roll that says which set it belongs to. times is the spec's own unless given, from 1 to MAX_TIMES.

例

import { rollMany } from "@johnmorrisdotca/korokoro";
import { normalizeSpec, seededSource } from "@johnmorrisdotca/korokoro";
const spec = normalizeSpec({ count: 2, sides: 6 });
console.log(rollMany(spec, 3, seededSource("table"), 0).rolls.length);
3

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/korokoro 1.16.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。