@r00t80y/array-shuffle
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Array Shuffle

Implementation of the "Fisher-Yates Shuffle" algorithm

Install

pnpm i @r00t80y/array-shuffle

How to use it

import { shuffle } from '@r00t80y/array-shuffle';

console.log(shuffle([1, 2, 3, 4, 5])); // [3, 2, 5, 4, 1]
const arr1 = [1, 2, 3, 4];
const arr2 = shuffle(arr1.slice());

console.log(arr1); // [1, 2, 3, 4]
console.log(arr2); // [3, 2, 4, 1]

Readme

Keywords

Package Sidebar

Install

npm i @r00t80y/array-shuffle

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

4.54 kB

Total Files

8

Last publish

Collaborators

  • r00t80y