fork関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A new, independent stream split off another: it takes one draw from
random and seeds a fresh generator from it. Use it to hand a part of the
work its own stream, so drawing more there never shifts what comes after.
For a sub-stream named by a label rather than by order, use deriveSeed.
インポート
import { fork } from "@johnmorrisdotca/tane";
定義
function fork(random: Random): Random
引数
| 名前 | 型 | 説明 |
|---|---|---|
random | Random | A random source returning values in [0, 1). |
戻り値
Random
A new, independent stream split off another: it takes one draw from random and seeds a fresh generator from it. Use it to hand a part of the work its own stream, so drawing more there never shifts what comes after. For a sub-stream named by a label rather than by order, use deriveSeed.
例
import { fork, mulberry32 } from "@johnmorrisdotca/tane";
console.log(fork(mulberry32(42))());0.9250807701610029出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。