An open API service indexing awesome lists of open source software.

https://github.com/xotic750/shuffle-x

Creates an array of shuffled values.
https://github.com/xotic750/shuffle-x

array browser fisher-yates-shuffle javascript nodejs shuffle

Last synced: 7 months ago
JSON representation

Creates an array of shuffled values.

Awesome Lists containing this project

README

          


Travis status


Dependency status


devDependency status


npm version


jsDelivr hits


bettercodehub score


Coverage Status

## shuffle-x

Creates an array of shuffled values.

### `module.exports(array)` ⇒ Array

Creates an array of shuffled values.

**Kind**: Exported function
**Returns**: Array - Returns the new shuffled array.
**Throws**:

- TypeError If array is null or undefined.

**See**: [https://en.wikipedia.org/wiki/Fisher-Yates_shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle)

| Param | Type | Description |
| ----- | ----------------------------------------- | --------------------- |
| array | Array \| Object | The array to shuffle. |

**Example**

```js
import shuffle from 'shuffle-x';

console.log(shuffle([1, 2, 3, 4])); // e.g. [4, 1, 3, 2]
```