fisher-yates-shuffle-js

1.0.0 • Public • Published

Shuffle

This is implementation of the Fisher-Yates shuffle algorithm in JavaScript. It's puts all items of given array in random order.

Installation

npm install fisher-yates-shuffle-js

Usage

const shuffle = require ('fisher-yates-shuffle-js');

var exampleArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

var shuffledArray = shuffle (exampleArray);

console.log (shuffledArray)

Example output:

[
  5, 7, 10, 9, 4,
  3, 2,  1, 6, 8
]

Package Sidebar

Install

npm i fisher-yates-shuffle-js

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

3.95 kB

Total Files

5

Last publish

Collaborators

  • ipyz