JSPM

random-natural

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17487
  • Score
    100M100P100Q132012F
  • License MIT

Return a natural number.

Package Exports

  • random-natural

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (random-natural) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

random-natural

Return a natural number.

MIT License

build:? coverage:?

Install

$ npm install --save random-natural

Usage

For more use-cases see the tests

var randomNatural = require('random-natural');

// API
// - randomNatural()
// - randomNatural(max)
// - randomNatural(min, max)

randomNatural();
// default range: 0 to 9007199254740992
// => randomInt(0, 9007199254740991);
// => 9527

randomNatural(5);
// => randomNatural(0, 5);
// => 3

randomNatural(10, 100);
// => 66

These min and max are inclusive, so they are included in the range.

This means randomNatural(1, 3) would return either 1, 2, or 3.

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.