Skip to content

@lelantos-org/sdk / primitives / shuffled

Function: shuffled() ​

ts
function shuffled<T>(items, pick?): T[];

Defined in: @lelantos-org/sdk/dist/core/random.d.ts:46

A uniformly random permutation of items, as a new array (downward Fisher–Yates).

pick(k) must return a uniform integer in [0, k); tests inject one to pin a specific permutation.

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
itemsreadonly T[]
pick?(n) => number

Returns ​

T[]