Random Function

Top  Previous  Next

Returns a random integer given a range of integers.

 

If just the range is passed in, the random value returned will be between 1 and the range. If both the lowerValue and the optional upperValue is passed in, the random value returned will be between the lowerValue and the upperValue. The maximum value that can be passed to this function is 2147483647.

 

Syntax

 

value = Random( range [ or lowerValue ], [ upperValue ] )

 

iParameters

range or lowerValue

 

range or lower value of range

upperValue

 

optional upper value of range

 

 

 

returns

 

the random value

 

Examples

 

PRINT Random( 10 )                      ' Returns a random number from 1 to 10

PRINT Random( 10, 20 )                ' Returns a random number from 10 to 20