UNPKG

es-next-tools

Version:

A comprehensive utility library for JavaScript and TypeScript that provides a wide range of functions for common programming tasks, including mathematical operations, date manipulations, array and object handling, string utilities, and more.

8 lines (7 loc) 208 B
export function shuffle(array) { for (let i = array.length - 1; i > 0; i--) { const j = ~~(Math.random() * (i + 1)); [array[i], array[j]] = [array[j], array[i]]; } return array; }