seedFrom関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A seed from whatever a person typed or a link carried. A whole number from
0 to 2^32 − 1, as a number or as its digits, is that seed; any other text
is hashed with hashSeed, so "table-7" is a seed as good as 42. Space
around text is dropped first. Note that the text "42" and the number 42 are
the same seed, and that hashSeed("42") is a different one.
インポート
import { seedFrom } from "@johnmorrisdotca/tane";
定義
function seedFrom(input: string | number): number
引数
| 名前 | 型 | 説明 |
|---|---|---|
input | string | number | A numeric seed or text to normalize as a seed. |
戻り値
number
A seed from whatever a person typed or a link carried. A whole number from 0 to 2^32 − 1, as a number or as its digits, is that seed; any other text is hashed with hashSeed, so "table-7" is a seed as good as 42. Space around text is dropped first. Note that the text "42" and the number 42 are the same seed, and that hashSeed("42") is a different one.
例
import { seedFrom } from "@johnmorrisdotca/tane";
console.log([seedFrom("42"), seedFrom(42), seedFrom("room-7")]);[ 42, 42, 948657874 ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。