# crypto-shuffle

> Cryptographically secure shuffle using the Fisher-Yates algorithm. The browser's (or NodeJS) crypto services are used to generate strong random numbers.

Latest version **1.0.1** (published 2017-05-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install crypto-shuffle
pnpm add crypto-shuffle
yarn add crypto-shuffle
bun add crypto-shuffle
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-05-19 |
| First published | 2017-05-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Richard Schneider |
| Maintainers | makaretu |
| Keywords | crypto, random, fisher-yates, shuffle, secure, card, game |

## Links

- npm: https://www.npmjs.com/package/crypto-shuffle
- Repository: https://github.com/richardschneider/crypto-shuffle
- Issues: https://github.com/richardschneider/crypto-shuffle/issues
- npm.io page: https://npm.io/package/crypto-shuffle

## Dependencies (1)

- [get-random-values](https://npm.io/package/get-random-values.md) ^1.2.0

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-05-19
- 1.0.0 — 2017-05-19
- 0.1.0 — 2017-05-18
- 0.0.1 — 2017-05-18

## README

# crypto-shuffle
[![Travis build status](https://travis-ci.org/richardschneider/crypto-shuffle.svg)](https://travis-ci.org/richardschneider/crypto-shuffle)
[![Coverage Status](https://coveralls.io/repos/github/richardschneider/crypto-shuffle/badge.svg?branch=master)](https://coveralls.io/github/richardschneider/crypto-shuffle?branch=master)
[![npm version](https://badge.fury.io/js/crypto-shuffle.svg)](https://www.npmjs.com/package/crypto-shuffle) 


A cryptographically secure shuffle using the modern [Fisher-Yates algorithm](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle).  The browser's (or Node.js) crypto services are used to generate strong random numbers;  see [get-random-values](https://github.com/KenanY/get-random-values) for more details. 

## Getting started

**crypto-shuffle** is available for both Node.js and the browser.  Most modern browsers are supported.  If you want to know if your browser is compatible, run the [online test suite](https://rawgit.com/richardschneider/crypto-shuffle/master/test/index.html).

Install with [npm](http://blog.npmjs.org/post/85484771375/how-to-install-npm)

    > npm install crypto-shuffle --save

### Node

Include the package and the shuffle a deck of cards

    var shuffle = require('crypto-shuffle')
    
    var deck = ["AS", "KS", "QS", "JS", "TS", "9S"]
    shuffle(deck)
    console.log(deck)

### Browser

Include the package from your project

    <script src="./node_modules/crypto-shuffle/dist/crypto-shuffle.min.js" type="text/javascript"></script>

Or better yet, from the [unpkg CDN](https://unpkg.com)

    <script src="https://unpkg.com/crypto-shuffle/dist/crypto-shuffle"></script>

This will provide `shuffle` as a global object, or `define` it if you are using [AMD](https://en.wikipedia.org/wiki/Asynchronous_module_definition).

    <script>
        var deck = ["AS", "KS", "QS", "JS", "TS", "9S"]
        shuffle(deck)
        alert(deck)
    </script>

---
_Source: https://npm.io/package/crypto-shuffle · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
