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 · Games and state

shuffledDeckfunction

The deck shuffled for one deal of one game: the same seed and deal always the same order, so a game kept as its seed and moves deals itself again exactly, and reloading can never re-deal a hand somebody has seen.

Import it

import { shuffledDeck } from "@johnmorrisdotca/toranpu";

Definition

function shuffledDeck(seed: number, deal: number, leaveOut?: readonly CardId[]): CardId[]

Parameters

NameTypeDescription
seednumber

The numeric seed that reproduces the same shuffle or deal.

dealnumber

The deal number or dealing specification.

leaveOut (optional)readonly string[]

Cards to omit from the generated deck or possibilities.

Returns

string[]

The deck shuffled for one deal of one game: the same seed and deal always the same order, so a game kept as its seed and moves deals itself again exactly, and reloading can never re-deal a hand somebody has seen.

Examples

import { shuffledDeck } from "@johnmorrisdotca/toranpu";

console.log(shuffledDeck(42, 0).slice(0, 7));
[
  'KC', '9S',
  '4C', '5D',
  'QS', 'AD',
  '4H'
]

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/toranpu 2.15.0.