mixCards関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A hand mixed up, as a new list: the same cards in another order, never the order given (where a hand
has two cards or more that differ), so a mix is always seen to change something. random is any
source of numbers in [0, 1); unless given, Math.random.
インポート
import { mixCards } from "@johnmorrisdotca/toranpu/element";
ほかのエクスポート元: @johnmorrisdotca/toranpu/element/define
定義
function mixCards(cards: readonly string[], random?: () => number): string[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
cards | readonly string[] | The cards in their current order. |
random (省略可) | () => number | A source of numbers in [0, 1), such as seededRandom(seed). |
戻り値
string[]
A hand mixed up, as a new list: the same cards in another order, never the order given (where a hand has two cards or more that differ), so a mix is always seen to change something. random is any source of numbers in [0, 1); unless given, Math.random.
例
import { mixCards } from "@johnmorrisdotca/toranpu/element";
import { seededRandom } from "@johnmorrisdotca/toranpu/deck";
console.log(mixCards(["AS", "KH", "TD"], seededRandom(42)));[ 'TD', 'AS', 'KH' ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。