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

shuffledfunction

A shuffled copy; the list given is left alone. The same order shuffle would make.

Import it

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

Definition

function shuffled<T>(random: Random, items: readonly T[]): T[]

Parameters

NameTypeDescription
randomRandom

A random source returning values in [0, 1).

itemsreadonly T[]

The items to choose or shuffle; shuffle mutates this array, while shuffled copies it.

Returns

T[]

A shuffled copy; the list given is left alone. The same order shuffle would make.

Examples

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

const random = mulberry32(42);
console.log(shuffled(random, ["A", "B", "C"]));
[ 'C', 'A', 'B' ]

What it prints (run when this page was built)

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