https://github.com/rwieruch/synchronized-array-shuffle
synchronized shuffling for arrays
https://github.com/rwieruch/synchronized-array-shuffle
shuffle shuffle-array
Last synced: 19 days ago
JSON representation
synchronized shuffling for arrays
- Host: GitHub
- URL: https://github.com/rwieruch/synchronized-array-shuffle
- Owner: rwieruch
- License: mit
- Created: 2017-12-19T01:33:51.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-25T05:45:19.000Z (over 6 years ago)
- Last Synced: 2025-03-24T23:51:53.532Z (29 days ago)
- Topics: shuffle, shuffle-array
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# synchronized-array-shuffle
[](https://travis-ci.org/rwieruch/synchronized-array-shuffle)
Shuffle multiple arrays [randomly](https://www.npmjs.com/package/knuth-shuffle) and keep them synchnorized.
## Install & Usage
On the command line:
`npm install synchronized-array-shuffle`
In your file:
```javascript
import synchronizedShuffle from 'synchronized-array-shuffle';const A = ['a', 'b', 'c'];
const B = ['1', '2', '3'];const [ A_shuffled, B_shuffled ] = synchronizedShuffle([ A, B ]);
// possible output
console.log(A_shuffled);
// ['c', 'a', 'b']
console.log(B_shuffled);
// ['3', '1', '2']
```