1.2.0 • Published 4 years ago

mzs-randomarray v1.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Random Array Generator

This package returns an array of integers of random length from 3 to max based on parameter. The array will be randomly filled in the range of default -30 < value < 500.

Purpose

This package can make creating a random array easy, and is useful for testing sort algorithms.

Installation

npm i mzs-randomarray

Usage

The function takes 3 parameters, all of them have default values: createRandomArray(maxNum, minV = -30, maxV = 500)

  • max = the maximum length of the array, randomly generated.
  • cb = arrValues and defaulted so only a single parameter is used.
  • It is recommended that you set the output of this function into a variable, as shown below.

  • const cRA = require('mzs-random-array')

    (n) max possible lenthminV rangemaxV range
    cRA()10-30500
    cRA(20)20-30500
    cRA(20,0)200500
    cRA(10,0,25)10025
    cRA('bob')10-30500
  • const arrayToBeSorted = createRandomArray(12) ~ set random array to preserve the array for reference

Tests

Run node test.js will produce two tables, one testing non-inter input will default max=10, and second will use integer for max=20.

Contributing

See the file named CONTRIBUTING

1.2.0

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago