il_random_number()
Generate a random number within a range, with a chosen number of decimal places.
Syntax
il_random_number(min, max, decimals)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
min |
int | yes | Lower bound. |
max |
int | yes | Upper bound. |
decimals |
int | yes | Number of decimal places (0 for a whole number). |
Returns
A random number.
Example
record_create("orders", [
"total" => il_random_number(10, 500, 2),
"qty" => il_random_number(1, 20, 0)
]);
Example output
347.82
Notes
- For testing only.
See also: il_random_option()