Skip to content

williepotgieter/random-array-generator

Repository files navigation

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]

Acknowledgments

mersenne-twister

License

MIT

About

Generates a unique array of random numbers using the Mersene-twister algorithm.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published