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

shuffledDeckfunction

A deck shuffled from a seed: the same seed, the same order, in every browser and every test.

Import it

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

Definition

function shuffledDeck(seed: number): Card[]

Parameters

NameTypeDescription
seednumber

The numeric seed that reproduces the same shuffle or deal.

Returns

Card[]

A deck shuffled from a seed: the same seed, the same order, in every browser and every test.

Examples

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

console.log(shuffledDeck(42).slice(0, 7));
[
  { suit: 'clubs', rank: 3 },
  { suit: 'clubs', rank: 9 },
  { suit: 'hearts', rank: 2 },
  { suit: 'hearts', rank: 13 },
  { suit: 'clubs', rank: 13 },
  { suit: 'diamonds', rank: 9 },
  { suit: 'spades', rank: 7 }
]

What it prints (run when this page was built)

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