File: README.md

package info (click to toggle)
node-mess 0.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 76 kB
  • ctags: 2
  • sloc: makefile: 2; sh: 2
file content (30 lines) | stat: -rw-r--r-- 687 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
mess
====

Missing shuffle function for arrays in javascript.
This is [Fisher–Yates shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle), and it's very fast.

## Installation

```
npm install mess
```

## Usage

```javascript
var mess = require("mess");

console.log(mess([1,2,3,4,5,6,7,8,9,0]));
// output will be something like:
// [ 7, 9, 2, 0, 6, 8, 5, 3, 1, 4 ]
```

## Why mess

Because naming modules is hard and shuffle is already taken.

## Authors

* [Ronald Fisher and Frank Yates](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle)
* [People on internet](http://stackoverflow.com/questions/6274339/how-can-i-shuffle-an-array-in-javascript#6274398)