Skip to the content

Tenka天下

Play seeded world conquest for two to six, with dice battles, cards, computer players and saved games.

Tenka means the world under heaven in Japanese. About the name

Contents

Reference · Rules, maps and records

shuffledfunction

A list in a random order (Fisher and Yates), and the state after it; the list given is left alone.

Import it

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

Definition

function shuffled<T>(state: number, items: readonly T[]): { value: T[]; state: number; }

Parameters

NameTypeDescription
statenumber

The seeded random generator state before the draw.

itemsreadonly T[]

The items to shuffle without changing their input order.

Returns

{ value: T[]; state: number; }

A list in a random order (Fisher and Yates), and the state after it; the list given is left alone.

Examples

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

console.log(shuffled(42,["A","B","C"]));
{ value: [ 'C', 'A', 'B' ], state: 3663131668 }

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/tenka 2.2.0.