Rnd

Top  Previous  Next

function Rnd() As Single

 

Returns a random number less than 1, but greater than or equal to zero.

 

To produce random integers in a given range, use the following formula:

randomvalue = Trunc((upperbound - lowerbound + 1) * Rnd() + lowerbound)

 

Example:

Dim v
 
= Rnd
' returns eg. v = 0,262725505512208
 
= CInt(Rnd * 1000)
' returns eg. v = 673




Translate document: