counted関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A seeded stream that counts its own draws, so that it can be written down
at any moment and picked up later: const random = counted(42), draw from
it as from any stream, then keep random.position(). The numbers are those
of mulberry32(seed), draw for draw.
インポート
import { counted } from "@johnmorrisdotca/tane";
定義
function counted(seed: number, draws?: number): CountedRandom
引数
| 名前 | 型 | 説明 |
|---|---|---|
seed | number | The numeric seed, read as an unsigned 32-bit integer by the stream. |
draws (省略可) | number | The nonnegative number of draws already consumed. |
戻り値
CountedRandom
A seeded stream that counts its own draws, so that it can be written down at any moment and picked up later: const random = counted(42), draw from it as from any stream, then keep random.position(). The numbers are those of mulberry32(seed), draw for draw.
例
import { counted } from "@johnmorrisdotca/tane";
const position = { seed: 42, draws: 3 };
console.log(counted(42, 3).position());{ seed: 42, draws: 3 }出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。