random-array-generator
Generates an array of unique random numbers using a Mersene-twister algorithm.
Last updated 2 years ago by williepotgieter .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install random-array-generator 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.7                                ...           latest (2 years ago)

8 Versions

  • 1.0.7                                ...           2 years ago
  • 1.0.6                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 3
Last Day 1
Last Week 1
Last Month 10
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |