Skip to main content

shuffle

Shuffles the elements of an array in place.

Parameters

ParameterTypeOptionalDefaultDescription
arrayArrayfalseThe array to shuffle.

Returns

Array

Example

shuffle([1, 2, 3]); // [2, 1, 3]
shuffle(["John", 12, "USA"]); // ["USA", "12", "John"]