1.0.0 • Published 7 months ago
ranum v1.0.0
Random Number or Boolean Generator
Installation
This package can be installed using
npm i ranum
Usage
Importing
const ranum = require('ranum')
Code
// Generate a random integer between 1 and 10 (inclusive)
const randomInteger = ranum.ranumInt(1, 10);
console.log(`Random Integer: ${randomInteger}`); // Example output: 7
// Generate a random decimal between 1 and 10 (exclusive of 10)
const randomDecimal = ranum.ranumDecimal(1, 10);
console.log(`Random Decimal: ${randomDecimal}`); // Example output: 6.23456
// Generate a random boolean value
const randomBoolean = ranum.ranumBool();
console.log(`Random Boolean: ${randomBoolean}`); // Example output: true
Functions
ranumInt(min, max)
Generates a random integer between min
and max
(inclusive).
Parameters
min
(Number): The minimum value.max
(Number): The maximum value.
Returns
- A random integer between
min
andmax
.
ranumDecimal(min, max)
Generates a random decimal between min
and max
(exclusive of max
).
Parameters
min
(Number): The minimum value.max
(Number): The maximum value.
Returns
- A random decimal between
min
andmax
.
ranumBool()
Generates a random boolean value (true
or false
).
Parameters
- None.
Returns
true
orfalse
.
1.0.0
7 months ago