Skip to the content

Tane documentation

Tane API: every export

Every export of every entry point, each with its own page. This page keeps the addresses the old one-page reference had.

@johnmorrisdotca/tane/react

DailySeedtype

Today, as useDailySeed hands it back: the day written YYYY-MM-DD, and its seed.

useDailySeedfunction

Today's day and seed, which change on their own at midnight in timeZone (UTC unless named): a page left open overnight moves to the new day's puzzle without a reload.

useSeededfunction

Something made once from a seeded stream, and made again only when the seed changes: useSeeded(seed, (random) => shuffled(random, deck)).

@johnmorrisdotca/tane/element

definePickerfunction

Defines the picker or a subclass under a host's tag; safe on a server.

parsePickerItemsfunction

Reads a bounded list, one item per line or a JSON string array.

TanePickDetailtype

Native event detail: list indices instead of names or other item text.

TanePickerclass

A seeded item picker and group maker, using the native random and draw functions.

TanePickerModetype

The picker modes: sample without replacement, shuffled list or balanced groups.

TanePickerOptionstype

Host data, a native random stream, optional weights and a result callback.

@johnmorrisdotca/tane/element/define

definePickerfunction

Defines the picker or a subclass under a host's tag; safe on a server.

parsePickerItemsfunction

Reads a bounded list, one item per line or a JSON string array.

TanePickDetailtype

Native event detail: list indices instead of names or other item text.

TanePickerclass

A seeded item picker and group maker, using the native random and draw functions.

TanePickerModetype

The picker modes: sample without replacement, shuffled list or balanced groups.

TanePickerOptionstype

Host data, a native random stream, optional weights and a result callback.

@johnmorrisdotca/tane

addDaysfunction

The day by days after (or, negative, before) a day.

belowfunction

An integer in [0, n): one draw.

chancefunction

True with probability p, from 0 (never) to 1 (always): one draw.

checkBlocksfunction

The blocks in ascending order, checked: whole numbers, inside 1 to most, none overlapping another.

cliLanguagefunction

The language the command line speaks: --lang, or the environment's, or the system's; Japanese for ja…, English for anything else.

countedfunction

A seeded stream that counts its own draws, so that it can be written down at any moment and picked up later: const random = counted(42), draw from it as from any stream, then keep random.position().

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().

dailySeedfunction

Today's seed, the date as a number: 2026-09-30 is 20260930.

dayKeyfunction

The day a moment falls on, in UTC or in the named IANA time zone.

DayKeytype

A calendar date, YYYY-MM-DD.

dayOfSeedfunction

The day a seed names inside a block, or null for a seed that names none.

daysBetweenfunction

How many days to is after from: negative when it is before.

daySeedfunction

A day's seed inside a block kept for it: the block's first seed plus the date as a number.

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.

distinctBelowfunction

count different integers below limit, in the order drawn, by drawing again whenever a number comes up twice.

drawSeedfunction

A seed from 1 to most, any of them as likely as another, skipping every reserved block: one draw.

fillInfunction

Put values into a string's braces: fillIn("Seed {seed}", { seed: 42 }) is "Seed 42".

floatfunction

A number in [min, max): one draw.

forkfunction

A new, independent stream split off another: it takes one draw from random and seeds a fresh generator from it.

freshSeedfunction

A new seed for something nobody asked for by number, drawn from Math.random.

fromJSONfunction

A position from JSON that toJSON wrote.

fromTextfunction

A position from a line toText wrote, with any space around it.

hashSeedfunction

A seed from any text: hashSeed("room-7") is the same unsigned 32-bit integer everywhere.

inBlockfunction

Whether a seed falls inside a block.

intfunction

An integer from min to max, both included: one draw.

isDayKeyfunction

Whether a text is a real date written YYYY-MM-DD: 2026-02-30 is not.

isSeedfunction

Whether a value read from outside (an address, a request body) is a seed: an integer from 1 to most.

languageOffunction

The language a tag such as ja-JP or en_US.UTF-8 names: Japanese for anything that starts ja, English otherwise.

mulberry32function

A seeded stream: mulberry32(42) returns the same numbers every time it is made.

nextDayStartfunction

The first moment of the day after the one at falls on, in that zone: when a daily seed next changes.

normalfunction

A number from a normal distribution (Box–Muller): two draws.

pickfunction

One item of a list, each as likely as the next: one draw.

Randomtype

A number in [0, 1), like Math.random, from a stream a seed fixes.

randomAtfunction

A stream that starts draws numbers into seed's: randomAt(42, 7)() is the eighth number of mulberry32(42), reached without drawing the first seven.

runClifunction

Run the command line.

samplefunction

count items of a list, no item twice, in the order drawn: a partial Fisher–Yates, one draw each.

SAVE_FORMATconstant

The shape of the JSON and the text this package writes.

savedStreamfunction

A position as the object toJSON writes: the format, the seed, the draws and the state they come to.

SavedStreamtype

A stream's position as toJSON writes it.

SEED_MOSTconstant

The largest seed: it travels as a plain integer, so it stays a positive 32-bit signed one.

SeedBlocktype

A range of seeds kept aside: from up to, not including, from + size.

seedFromfunction

A seed from whatever a person typed or a link carried.

shufflefunction

The list in place, in a random order (Fisher–Yates, from the end): one draw for each item but the first.

shuffledfunction

A shuffled copy; the list given is left alone.

stateAtfunction

The generator's state after draws numbers have been taken from seed: an unsigned 32-bit integer.

stepfunction

One step of mulberry32 as a pure function: the number drawn and the state to keep for the next one.

Steptype

One draw and the state after it, for code that keeps the state itself (in a database row, say).

StreamPositiontype

Where a stream is: the seed it started from, and how many numbers have been drawn from it.

STRINGSconstant

Every string, in both languages.

toCSVfunction

The next count numbers from a position as CSV for a spreadsheet: a header, then one row a draw, with the draw's number counted from 1, its value, and the generator's state after it.

toJSONfunction

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

toTextfunction

A position as one line to paste into a chat or a bug report: tane:1:42:7 is format 1, seed 42, 7 draws in.

VERSIONconstant

The version of this package, as package.json has it.

weightedIndexfunction

An index into weights, each chosen in proportion to its weight: one draw.

weightedPickfunction

One item, chosen by the matching weight: one draw.