Overview
TheRANDOM()
function in Oxla generates a random number within a defined range. By default, the range is between 0 (inclusive) and 1 (exclusive), resulting in a value greater than or equal to 0 and less than 1.
Syntax
The syntax for generating a random integer or floating-point number using theRANDOM()
function is as follows:
There are no parameters or arguments for the
RANDOM()
function.Examples
Case #1: Generating a random number
The RANDOM() function generates a random number greater than or equal to zero but less than one by default. The following statement can be used to retrieve a random number:Case #2: Generating a random decimal number within a range
To generate a random decimal number between two values, you can use the following statement:- “a” represents the lower bound of the range.
- “b” represents the upper bound of the range.
It is important to note that the function will never return the maximum value of b.