Skip to content

Function: shuffle()

shuffle<T>(array): void

Defined in: collection.ts:78

Shuffles the items of an array in-place (modifing the source array).

Type Parameters

T

T

Parameters

array

T[]

The array to shuffle.

Returns

void

Example

ts
const arr = [ 'A', 'B', 'C' ]
shuffle(arr) // eg. [ 'C', 'A', 'B' ]