Skip to the content

Dominoドミノ

Deal seeded dominoes, play Mexican Train with native rules and computers, and replay a saved game.

Domino is the Japanese borrowed word ドミノ for dominoes. About the name

Contents

Reference · Tiles, Mexican Train and replay

shuffledfunction

A copy of the list in a random order (Fisher–Yates); the list given is left alone.

Import it

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

Definition

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

Parameters

NameTypeDescription
itemsreadonly T[]

The items to copy and shuffle.

randomRandom

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

Returns

T[]

A copy of the list in a random order (Fisher–Yates); the list given is left alone.

Examples

import { seededRandom, shuffled } from "@johnmorrisdotca/domino";

console.log(shuffled(["A","B","C"],seededRandom(42)));
[ 'C', 'A', 'B' ]

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/domino 1.1.4.