Skip to the content

Tane種

Reproduce numbers from a seed, shuffle or pick items, share a daily puzzle and resume a saved stream.

Tane means seed in Japanese. About the name

Contents

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

NameTypeDescription
inputstring | 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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/tane 1.3.0.