Javascript Math

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
(Created page with "Math global functions. == Static methods == * '''abs(value)''' Return the absolute value of an integer.<br> Return 0 if 'value' is not an integer. * '''max(value1 [, value2...")
 
(Static methods)
Line 18: Line 18:
  
 
* '''random([min [, max]])'''
 
* '''random([min [, max]])'''
Return a random integer value in interval (min .. max).<br>
+
Return a random integer value in interval [min .. max).<br>
 
'''min''' defaults to 0, '''max''' defaults to largest integer value.<br>
 
'''min''' defaults to 0, '''max''' defaults to largest integer value.<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>

Revision as of 12:01, 2 March 2016

Math global functions.

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]])

Return a random integer value in interval [min .. max).
min defaults to 0, max defaults to largest integer value.
Function call fails if min < 0 or max < 0 or min >= max.

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers