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

CountedRandomtype

A stream that knows where it is: call it for the next number, as any Random; read seed and draws, or take its position().

Import it

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

Definition

type CountedRandom = Random & {
    readonly seed: number;
    readonly draws: number;
    position(): StreamPosition;
};

Examples

import type { CountedRandom } from "@johnmorrisdotca/tane";
import { counted } from "@johnmorrisdotca/tane";

const position = { seed: 42, draws: 3 };
const value: CountedRandom = counted(42, 3);
console.log(value.position());
{ seed: 42, draws: 3 }

What it prints (run when this page was built)

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