shuffle-matrix

1.1.1 • Public • Published

Shuffle-Matrix

npm

A JavaScript implementation of the Fisher-Yates Shuffle algorithm for array and matrix.

Requirements

  • Node.js 6+

Installation

npm install shuffle-matrix --save

Usage

let shuffle = require('shuffle-matrix');
let origin = [1 , 2 , 3 , 4 , 5 , 6 ,  7 , 8 , 9];
let result = shuffle(origin);
let randomFunc = function() {
    return 0.618
};
let shuffle = require('shuffle-matrix');
let origin = ['a', 'b', 'c', 'd', 'e', 'f'];
let result = shuffle(origin, randomFunc);
let shuffle = require('shuffle-matrix');
let origin = [
    [0, 1],
    2,
    [3, 4, 5, 6, 7],
    [8, 9, 10],
    11,
    [12, 13]
];
let result = shuffle(origin);

Package Sidebar

Install

npm i shuffle-matrix

Weekly Downloads

1

Version

1.1.1

License

MIT

Last publish

Collaborators

  • chengxu1973