Skip to content

Fisher-Yates shuffle of an array of items producing an unbiased permutation.

License

Notifications You must be signed in to change notification settings

kimmelsg/array-shuffle

Repository files navigation

array-shuffle Build Status codecov

Fisher-Yates shuffle of an array of items producing an unbiased permutation.

Install

$ npm install @kimmel/array-shuffle

Usage

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

About

Fisher-Yates shuffle of an array of items producing an unbiased permutation.

Resources

License

Stars

Watchers

Forks

Packages

No packages published