stack

Home > @infiniteobjects/core-library-web > Arrays > shuffle

Arrays.shuffle() method

Returns a copy of the array with the order of items randomized.

Signature:

static shuffle<T>(collection: T[]): T[];

Parameters

Parameter Type Description
collection T[]  

Returns:

T[]

Remarks

Uses the Durstenfeld algorithm which is based on the Fisher–Yates algorithm.