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

toJSONfunction

A position as JSON, two spaces deep, with the format's number first. fromJSON reads it back.

Import it

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

Definition

function toJSON(position: StreamPosition): string

Parameters

NameTypeDescription
positionStreamPosition

The stream’s seed and nonnegative count of consumed draws.

Returns

string

A position as JSON, two spaces deep, with the format's number first. fromJSON reads it back.

Examples

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

const position = { seed: 42, draws: 3 };
console.log(toJSON(position));
{
  "format": 1,
  "generator": "tane 1.3.0",
  "algorithm": "mulberry32",
  "seed": 42,
  "draws": 3,
  "state": 1199730185
}

What it prints (run when this page was built)

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