2.0.0 • Published 11 months ago

npm-random-number v2.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

random-number

generate a random number

install

npm install npm-random-number

usage

var getRandom = require('npm-random-number');
getRandom(10); // sample output → 2691758172 # yes, this is just Math.random(), but it has some options

default options

the exported function takes an option object with 2 meaningful properties

  • min : smallest possible value to return. defaults to 0 or max - 1 if max is defined
  • max : largest possible value to return. defaults to 1 or min + 1 if min is defined

Examples

  • all two
// this is the functionality i like the most
var getGenerator = require('npm-random-number');
var options = {
  min:  2
, max:  20
}
getGenerator(options) // example outputs → 5757502331402711 456674056936625