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
| Name | Type | Description |
|---|---|---|
seed | number | The numeric seed that reproduces the same shuffle or deal. |
deal | number | 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)