@pacote/shuffle

An implementation of the Durstenfeld algorithm for shuffling collections.

Usage no npm install needed!

<script type="module">
  import pacoteShuffle from 'https://cdn.skypack.dev/@pacote/shuffle';
</script>

README

@pacote/shuffle

version minified minified + gzip

An implementation of the Durstenfeld algorithm for shuffling collections.

Installation

yarn add @pacote/shuffle

Usage

import { shuffle } from '@pacote/shuffle'

shuffle([1, 2, 3])

shuffle<T>(items: T[]): T[]

shuffle() takes an item sequence and returns a randomly permutated sequence of its elements.

License

MIT © Luís Rodrigues.