Skip to the content

Toranpuトランプ

Use a deck, play eleven games with computers, solve a solitaire, or display cards in your own design.

Toranpu is Japanese for playing cards. About the name

Contents

Reference · Deck tools

shuffledfunction

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

Import it

import { shuffled } from "@johnmorrisdotca/toranpu/deck";

Also exported from: @johnmorrisdotca/toranpu

Definition

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

Parameters

NameTypeDescription
itemsreadonly T[]

The items to shuffle without changing the input.

randomRandom

A source of numbers in [0, 1), such as seededRandom(seed).

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/toranpu/deck";

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/toranpu 2.15.0.