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

deriveSeedfunction

A seed of its own for one part of something seeded: deriveSeed(game, "deck") and deriveSeed(game, "dice") are two unrelated streams from one game's seed, and adding a third part later moves neither. Labels may be text or integers and are read in order, so deriveSeed(s, "round", 3) is round 3's. Returns an unsigned 32-bit integer.

Import it

import { deriveSeed } from "@johnmorrisdotca/tane";

Definition

function deriveSeed(seed: number, ...labels: readonly (string | number)[]): number

Parameters

NameTypeDescription
seednumber

The numeric seed, read as an unsigned 32-bit integer by the stream.

...labelsreadonly (string | number)[]

Ordered text or numeric labels that identify the sub-stream.

Returns

number

A seed of its own for one part of something seeded: deriveSeed(game, "deck") and deriveSeed(game, "dice") are two unrelated streams from one game's seed, and adding a third part later moves neither. Labels may be text or integers and are read in order, so deriveSeed(s, "round", 3) is round 3's. Returns an unsigned 32-bit integer.

Examples

import { deriveSeed } from "@johnmorrisdotca/tane";

console.log(deriveSeed(42, "round", 3));
597383337

What it prints (run when this page was built)

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