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

3.0.0 • Public • Published

array-shuffle

Randomize the order of items in an array

Uses the Durstenfeld algorithm which is based on the Fisher–Yates algorithm.

Install

$ npm install array-shuffle

Usage

import arrayShuffle from 'array-shuffle';

const shuffled = arrayShuffle([1, 2, 3, 4, 5, 6]);
//=> [3, 5, 4, 1, 2, 6]

API

arrayShuffle(array)

array

Type: Array

The array to shuffle.

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i array-shuffle

    Weekly Downloads

    28,060

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    3.1 kB

    Total Files

    5

    Last publish

    Collaborators

    • sindresorhus