Reference · Rules, tiles and records
shuffledfunction
A copy of the list in a random order (Fisher–Yates).
Import it
import { shuffled } from "@johnmorrisdotca/kumimoji";
Definition
function shuffled<T>(items: readonly T[], random: Random): T[]
Parameters
| Name | Type | Description |
|---|---|---|
items | readonly T[] | The items to copy and shuffle. |
random | Random | A reproducible random function returning values in [0,1). |
Returns
T[]
A copy of the list in a random order (Fisher–Yates).
Examples
import { seededRandom, shuffled } from "@johnmorrisdotca/kumimoji";
console.log(shuffled(["c","a","t"],seededRandom(42)));[ 't', 'c', 'a' ]What it prints (run when this page was built)