lib-random-array
v0.1.7
Published
A JavaScript library for generating arrays with various data types. Easily create arrays containing random numbers, strings, boolean values, and objects. Suitable for testing, populating, and creating examples.
Downloads
10
Maintainers
Readme
Lib-Random-Array
A JavaScript library for generating arrays with various data types. Easily create arrays containing random numbers, strings, boolean values, and objects. Suitable for testing, populating, and creating examples.
Installation
npm i lib-random-array
Example
import { UseRandomArray } from "lib-random-array";
const random = new UseRandomArray();
Array of numbers
console.log(random.number());
Array of strings
console.log(random.string());
Array of boolean
console.log(random.boolean());
Parameters
Method number()
length
- array length. Default is 10min
- minimum value. Default is 0max
- maximum value. Default is 10unique
- the uniqueness of numeric values. Default is TRUE
console.log(random.number(20, 0, 100, true));
Method string()
length
- array length. Default is 10character
- length of each string. Default is 10
console.log(random.string(20, 30));
Method boolean()
length
- array length. Default is 10
console.log(random.boolean(20));