Difference between revisions of "GetRandomNumber"

From Catglobe Wiki
Jump to: navigation, search
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{HelpFiles}}  
+
[[Category:General Functions]]
 +
{{HelpFiles}}
  
 
==== getRandomNumber ====
 
==== getRandomNumber ====
  
Generates a random number.  
+
Generates a random number.
  
The random number will be within the range specified(min value <= random number < max value), where 0 is the minimum value for a random number if only a maximum value is given as argument to the function.  
+
The random number will be within the range specified(min value <= random number < max value), where 0 is the minimum value for a random number if only a maximum value is given as argument to the function.
  
'''Syntax'''  
+
'''Syntax'''
  
getRandomNumber(maximum_value);  
+
getRandomNumber(maximum_value);
  
getRandomNumber(minimum_value, maximum_value);  
+
getRandomNumber(minimum_value, maximum_value);
  
'''Arguments'''  
+
'''Arguments'''
  
minimum_value: Is an expression with the type of number  
+
minimum_value: Is an expression with the type of number
  
maximum_value: Is an expression with the type of number  
+
maximum_value: Is an expression with the type of number
  
'''Return type'''  
+
'''Return type'''
  
number  
+
number
  
'''Examples'''  
+
'''Examples'''
  
 
''print("Random number 1: ");''
 
''print("Random number 1: ");''
  
''print(getRandomNumber(100, 200)); //Return a random number > 100 and < 200''
+
''print(getRandomNumber(100, 200)); //Return a random number >= 100 and < 200''
  
 
''print("Random number 2: ");''
 
''print("Random number 2: ");''
Line 33: Line 34:
 
''print(getRandomNumber(200)); //Return a random number < 200''
 
''print(getRandomNumber(200)); //Return a random number < 200''
  
'''Availability'''  
+
'''Availability'''
  
Version 4.8 __NOTOC__ <!-- imported from file: 414.htm-->  
+
Version 4.8 __NOTOC__
 
+
<!-- imported from file: 414.htm-->
[[Category:General_Functions]]
 

Latest revision as of 02:27, 20 June 2014


getRandomNumber

Generates a random number.

The random number will be within the range specified(min value <= random number < max value), where 0 is the minimum value for a random number if only a maximum value is given as argument to the function.

Syntax

getRandomNumber(maximum_value);

getRandomNumber(minimum_value, maximum_value);

Arguments

minimum_value: Is an expression with the type of number

maximum_value: Is an expression with the type of number

Return type

number

Examples

print("Random number 1: ");

print(getRandomNumber(100, 200)); //Return a random number >= 100 and < 200

print("Random number 2: ");

print(getRandomNumber(200)); //Return a random number < 200

Availability

Version 4.8