User Tools

Site Tools


syntax:functions:randbetween
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


syntax:functions:randbetween [2021/10/15 15:01] (current) – created craigt
Line 1: Line 1:
 +====== RandBetween(min_num, max_num) ======
 +Category:  Number function
 +
 +\\ 
 +=====Description=====
 +This function generates a random whole number between the values //min_num// and //max_num//.
 +
 +\\ 
 +=====Arguments=====
 +^Argument^Type^Description^
 +|min_num|Number|The minimum value of the returned number.  Must be less than or equal to //max_num//.|
 +|max_num|Number|The maximum value of the returned number.  Must be greater than or equal to //min_num//.|
 +\\ 
 +**Return value type:**  Number (Integer)
 +
 +\\ 
 +=====Remarks=====
 +The //min_num// and //max_num// values are inclusive and can be the returned value.
 +
 +The //min_num// value must be less than or equal to the //max_num// value, or an error is returned.
 +
 +//RandBetween// returns integer values.  If decimal values are used for //min_num// and/or //max_num// they are rounded up to the next integer and those values are used as the arguments.  See Examples, below.
 +
 +
 +\\ 
 +=====Examples=====
 +  randbetween(1,3)  //Return values will be 1, 2, or 3.
 +
 +  randbetween(6,8)  //Return values will be 6, 7, or 8.
 +
 +  randbetween(1.1, 2.9)  //Return values will be 2 or 3.  (1.1 is rounded to 2.  2.9 is rounded to 3.)
 + 
 +\\ 
 +=====See also=====
 +  * [[syntax:functions:random|Random()]]
 +
  
syntax/functions/randbetween.txt · Last modified: 2021/10/15 15:01 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki