Handlebar Helper Function: Random
Generates a random integer between two specified values. The function can handle both integers and floating-point numbers.
| Parameter | Type | Description |
|---|---|---|
first | number or string | Required. The minimum value. Must be a number or convertible to a number. |
second | number or string | Required. The maximum value. Must be a number or convertible to a number, and greater than or equal to first. |
The function returns a random integer that is greater than or equal to first and less than or equal to second. If you provide more than two arguments, the operation uses only the first two.
The function throws an exception if the second parameter is less than the first, or if either input is a string that can't be converted to a number.