This package can be installed using
npm i ranum
const ranum = require('ranum')
// 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
Generates a random integer between min
and max
(inclusive).
-
min
(Number): The minimum value. -
max
(Number): The maximum value.
- A random integer between
min
andmax
.
Generates a random decimal between min
and max
(exclusive of max
).
-
min
(Number): The minimum value. -
max
(Number): The maximum value.
- A random decimal between
min
andmax
.
Generates a random boolean value (true
or false
).
- None.
-
true
orfalse
.