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

Getting started

Getting started

Install Tane and reproduce the same sequence from one seed.

Install Tane and reproduce a stream from one seed. The pure engine works in Node 22 or later and in browsers; no DOM or runtime dependency is required.

Install

npm install @johnmorrisdotca/tane

The package includes its types. React is optional for the separate hooks entry.

Draw the same sequence

import { mulberry32, seedFrom } from "@johnmorrisdotca/tane";

const seed = seedFrom("room-7");
const first = mulberry32(seed);
const second = mulberry32(seed);
console.log([first(), first(), first()]);
console.log([second(), second(), second()]);
[ 0.27501549874432385, 0.8835344351828098, 0.677862610667944 ]
[ 0.27501549874432385, 0.8835344351828098, 0.677862610667944 ]

A source returns numbers in [0, 1). Each call advances it. Making a fresh source from the same seed starts that sequence again; reusing one continues it. seedFrom reads a numeric seed or hashes text.

Pick a recipe

Shuffle and pick, separate sub-streams, choose daily seeds, save a position, or embed and use hooks. The reference contains all native APIs.

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