Javascript Math
From Yate Documentation
(Difference between revisions)
(→Static methods) |
(→Static methods) |
||
Line 18: | Line 18: | ||
* '''random([min [, max]])''' | * '''random([min [, max]])''' | ||
− | + | Retrieve a random number.<br> | |
− | + | ||
Function call fails if min < 0 or max < 0 or min >= max.<br> | Function call fails if min < 0 or max < 0 or min >= max.<br> | ||
+ | Parameters:<br> | ||
+ | '''min''': Minimum value (interval lower bound). Defaults to 0<br> | ||
+ | '''max''': Maximum value (interval upper bound). Defaults to largest integer value<br> | ||
+ | Return:<br> | ||
+ | A random integer value in interval [min .. max).<br> |
Latest revision as of 12:10, 2 March 2016
Math global functions.
[edit] Static methods
- abs(value)
Return the absolute value of an integer.
Return 0 if 'value' is not an integer.
- max(value1 [, value2 [, ...]])
Return the largest value in parameters.
Return NaN if the parameters list contains only non integer values.
Non integer values are ignored.
- min(value1 [, value2 [, ...]])
Return the smallest value in parameters.
Return the largest integer value if the parameters list contains only non integer values.
Non integer values are ignored.
- random([min [, max]])
Retrieve a random number.
Function call fails if min < 0 or max < 0 or min >= max.
Parameters:
min: Minimum value (interval lower bound). Defaults to 0
max: Maximum value (interval upper bound). Defaults to largest integer value
Return:
A random integer value in interval [min .. max).