array-shuffle
Randomize the order of items in an array
Last updated 13 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install array-shuffle 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 4.1.0                                ...           latest (10 months ago)

7 Versions

  • 4.1.0                                ...           10 months ago
  • 4.0.0                                ...           a year ago
  • 3.0.0                                ...           5 years ago
  • 2.0.0                                ...           6 years ago
  • 1.0.1                                ...           10 years ago
  • 1.0.0                                ...           12 years ago
  • 0.1.0                                ...           13 years ago
Maintainers (1)
Downloads
Total 104
Today 1
This Week 8
This Month 44
Last Day 2
Last Week 11
Last Month 56
Dependencies (0)
None
Dev Dependencies (2)
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE