@bemoje/arr-shuffle

Shuffle items in an array in-place. Runtime: O(n)

Usage no npm install needed!

<script type="module">
  import bemojeArrShuffle from 'https://cdn.skypack.dev/@bemoje/arr-shuffle';
</script>

README

@bemoje/arr-shuffle

Shuffle items in an array in-place. Runtime: O(n)

Version

NPM version

Travis CI

dependencies

Dependencies

dependencies

Stats

NPM downloads Forks

Donate

Buy Me A Beer donate button PayPal donate button

Installation

npm install @bemoje/arr-shuffle
npm install --save @bemoje/arr-shuffle
npm install --save-dev @bemoje/arr-shuffle

Usage

import arrShuffle from '@bemoje/arr-shuffle'

arrShuffle([1, 2, 3])
//=> [2, 1, 3] - or some other random order

Tests

Uses Jest to test module functionality. Run tests to get coverage details.

npm run test

API

arrShuffle

Shuffle items in an array in-place. Runtime: O(n)

Parameters
  • arr Array The array to shuffle.
Returns

Array The shuffled array