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

x/proc/mod.ts>shuffle

A better way to work with processes in Deno.
Latest
function shuffle
import { shuffle } from "https://deno.land/x/proc@0.22.1/mod.ts";

Performs an in-place shuffle of an array in linear time.

This function uses the Fisher-Yates (also known as Knuth) shuffle algorithm to rearrange the elements in the array in a random order. The shuffle is performed in-place, meaning that it modifies the original array instead of creating a new one. The time complexity of the algorithm is O(n), where n is the number of elements in the array.

Parameters

items: T[]