Syntax :
Randomize [ lngSeed ]
lngSeed : Seed number for a sequence of pseudo random numbers ( optional )
Randomize [ lngSeed ]
lngSeed : Seed number for a sequence of pseudo random numbers ( optional )
Function RndInt ( intLoNum as Integer , intHiNum as Integer ) as Integer
Static blnSeeded as Boolean
Dim intRange as Integer
if blnSeeded = False Then
Randomize
blnSeeded = True
Enf if
intRange = intHiNum - intLoNum + 1
RndInt = Int ( intRange * Rnd + intLoNum )
End Function
Static blnSeeded as Boolean
Dim intRange as Integer
if blnSeeded = False Then
Randomize
blnSeeded = True
Enf if
intRange = intHiNum - intLoNum + 1
RndInt = Int ( intRange * Rnd + intLoNum )
End Function
This example is a function that uses the Randomize statement and Rnd function to return an integer in the range specified by the integer parameters intLoNum and intHiNum.
No comments:
Post a Comment