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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.0.0
    5,724
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 3.0.0
    5,724
  • 2.0.0
    3,658
  • 1.0.1
    17,228
  • 1.0.0
    2
  • 0.1.0
    2

Package Sidebar

Install

npm i array-shuffle

Weekly Downloads

26,614

Version

3.0.0

License

MIT

Unpacked Size

3.1 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus