Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including random-number-between with all npm packages installed. Try it out:

var randomNumberBetween = require("random-number-between")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

random-number-between v1.0.3

This is a simple module for Node.js made with the included Math functions of Node.js

Node.js Random Number Between

This is a simple module for Node.js made with the included Math functions of Node.js to create an array of random numbers. Usage is simple and an example has been included.

Usage

Example code:

var randnum = require('random-number-between');
var rand = randnum(1, 10, 5);
console.log(rand); // Example output: [ 3, 7, 1, 4, 9 ]

In the above example code, the first number in the second line (var rand = randnum(1, 10, 5)), the first number (1) is the minimum number, the second number (10) is the maximum number, and the third number (5) is the number of numbers to generate.

NOTE: In the included example.js, the line that has the correct way of requiring the package is commented out to allow it to run in that directory. In normal code, you will follow the example above and require the package by package name.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free