Skip to content

shuffle

Array.shuffle(array)

Returns a new array with the elements of array randomly shuffled.

Example

ts
import { Array } from "@monstermann/array";

Array.shuffle([1, 2, 3, 4]); // [3, 1, 4, 2] (random)
ts
import { Array } from "@monstermann/array";

pipe([1, 2, 3, 4], Array.shuffle()); // [3, 1, 4, 2] (random)