Modules
random

random

The random module allows you to generate a random number. By default the highest number is 100, but you can change that by specifying a number in the function. The highest number supported is 2,147,483,647 as that is the 32-bit integer limit.

Examples

Without Input

// Import module
const { random } = require("easyscriptjs");
 
// Generates a result from 1-100
const result = random();
 
// Generates a random number from 1 to 100 (the default)
console.log(result);
// 48

With Input

// Import module
const { random } = require("easyscriptjs");
 
// Generates a random number from 1 to 30
const result = random(30);
 
// Logs the result to console
console.log(result);
// 26