random-array-generator
v1.0.7
Published
Generates an array of unique random numbers using a Mersene-twister algorithm.
Downloads
31
Maintainers
Readme
Description
Generates an array of unique random integers using a Mersenne-twister algorithm.
Install
npm install random-array-generator
Usage
Add the following line of code to your project:
var generator = require('random-array-generator');
To generate an array of random numbers, pass an object into the "randomArray()" function, which will then return an array containing the generated numbers. The object must be in the form:
generator.randomArray({min: x, max: y, elements: z});
Where x and y represents the range (inclusive) of the random numbers to be generated and z is the number of random integers to be generated.
Example:
// import package into your project
var generator = require('random-array-generator');
// Generate 6 random numbers between 1 and 49 (inclusive) and log to the console.
console.log(generator.randomArray({min: 1, max: 49, elements: 6}));
// Result: [2, 34, 17, 11, 47, 25]