3.0.0 • Published 3 years ago

array-shuffle v3.0.0

Weekly downloads
17,483
License
MIT
Repository
github
Last release
3 years ago

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.