Reference · Streams, draws and seeds
seedFromfunction
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 it
import { seedFrom } from "@johnmorrisdotca/tane";
Definition
function seedFrom(input: string | number): number
Parameters
| Name | Type | Description |
|---|---|---|
input | string | number | A numeric seed or text to normalize as a seed. |
Returns
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.
Examples
import { seedFrom } from "@johnmorrisdotca/tane";
console.log([seedFrom("42"), seedFrom(42), seedFrom("room-7")]);[ 42, 42, 948657874 ]What it prints (run when this page was built)