@libshin/random-array

1.1.2 • Public • Published

TL;DR

Shuffle and shorten an array.

// randomArray(originArray)
randomArray([1, 2, 3, 4, 5, 6]);
// [4, 5, 3, 2, 1]

// randomArray(originArray, maxLength)
randomArray([1, 2, 3, 4, 5, 6], 2);
// [5, 3]

// randomArray(originArray, [minLength, maxLength])
randomArray([1, 2, 3, 4, 5, 6], [3, 5]);
// [4, 6, 2, 3]

Install

Browser

<script src="https://unpkg.com/@libshin/random-array(@version)/build/random-array.umd.js"></script>

You don't have to specify the version of the module. By default it will redirect to the latest version.

NPM

npm i --save @libshin/random-array

Yarn

yarn add @libshin/random-array

Import

Browser

const randomArray = window["@libshin/random-array"];

Node

const randomArray = require("@libshin/random-array");

ES Module

import randomArray from "@libshin/random-array";

Package Sidebar

Install

npm i @libshin/random-array

Weekly Downloads

1

Version

1.1.2

License

MIT

Unpacked Size

69.6 kB

Total Files

10

Last publish

Collaborators

  • ayc0
  • gandem