1.0.0 • Published 7 years ago

simplerandom.js v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

simplerandom.js

A simple Node.js random library.


What is simplerandom.js?

simplerandom.js is a simple Node.js library used to generate numbers with a random outcome.


Usage

var random = require("simplerandom.js");

// Generate a random number between 0 and 1.
random(0, 1); // => 0

// Generate 5 random numbers between 0 and 1 as an array.
random(0, 1, 5); // => [ 1, 1, 0, 0, 1 ]

// Generate a random number between 0 and 1. (Outcome includes min/max)
random.inclusive(0, 1); // => 1

// Generate 5 random numbers between 0 and 1 as an array. (Outcome includes min/max)
random.inclusive(0, 1, 5); // => [ 0, 0, 1, 0, 1 ]

// Generate a random number between 0 and 1. (Outcome does not include min/max)
// NaN outcome because there is no rounded value between 0 and 1 that does not equal 0 or 1.
random.exclusive(0, 1); // => NaN

// Generate a random number between 0 and 2. (Outcome does not include min/max)
random.exclusive(0, 2); // => 1

// Generate 5 random numbers between 0 and 2. (Outcome does not include min/max)
random.exclusive(0, 2, 5); // => [ 1, 1, 1, 1, 1 ]

Changelog

1.0.0

  • Initial upload

Credits