Skip to content

Implementation of Fisher-Yates shuffle algorithm in JavaScript

License

Notifications You must be signed in to change notification settings

IpyZ/Fisher-Yates-shuffle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
]

About

Implementation of Fisher-Yates shuffle algorithm in JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published