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

SavedStreamtype

A stream's position as toJSON writes it.

Import it

import type { SavedStream } from "@johnmorrisdotca/tane";

Definition

type SavedStream = {
    format: typeof SAVE_FORMAT;
    generator: string;
    algorithm: "mulberry32";
    seed: number;
    draws: number;
    state: number;
};

Members

NameTypeDescription
format1

The shape of this object: SAVE_FORMAT.

generatorstring

What wrote it, such as "tane 1.2.0". For people; nothing reads it back.

algorithm"mulberry32"

The algorithm. Always "mulberry32".

seednumber
drawsnumber
statenumber

The generator's state at that position: stateAt(seed, draws). Checked on the way back in.

Examples

import type { SavedStream } from "@johnmorrisdotca/tane";
import { savedStream } from "@johnmorrisdotca/tane";

const value: SavedStream = savedStream({ seed: 42, draws: 3 });
console.log(value.state);
1199730185

What it prints (run when this page was built)

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