https://github.com/kimmelsg/array-shuffle
Fisher-Yates shuffle of an array of items producing an unbiased permutation.
https://github.com/kimmelsg/array-shuffle
Last synced: 2 months ago
JSON representation
Fisher-Yates shuffle of an array of items producing an unbiased permutation.
- Host: GitHub
- URL: https://github.com/kimmelsg/array-shuffle
- Owner: kimmelsg
- License: mit
- Created: 2018-10-24T12:47:19.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-08T15:10:33.000Z (over 6 years ago)
- Last Synced: 2025-02-12T18:45:48.528Z (3 months ago)
- Language: TypeScript
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# array-shuffle [](https://travis-ci.org/kimmelsg/array-shuffle) [](https://codecov.io/gh/kimmelsg/array-shuffle?branch=master)
> [Fisher-Yates](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle) shuffle of an array of items producing an unbiased permutation.
## Install
```
$ npm install @kimmel/array-shuffle
```## Usage
```js
import shuffle from '@kimmel/array-shuffle';const shuffledArray = shuffle([1, 2, 3, 4, 5, 6]);
//=> [3, 1, 2, 5, 6, 4]
````shuffle` does _not_ mutate the original array.
## API
### shuffle(items)
#### items
Type: `array`
`['hello', 2, 5, { foo: 'bar' }]`
## License
MIT © [Ryan Castner](https://kimmel.com)