Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/array/index.ts>shuffle

A JavaScript extension package for building strong and modern applications.
Latest
function shuffle
import { shuffle } from "https://deno.land/x/ayonli_jsext@v0.9.72/array/index.ts";

Reorganizes the elements in the array in random order.

This function mutates the array.

Examples

Example 1

import { shuffle } from "@ayonli/jsext/array";

const arr = [1, 2, 3, 4, 5];

console.log(shuffle(arr)); // [3, 1, 5, 2, 4] for example
console.log(arr); // [3, 1, 5, 2, 4]