Wednesday, March 7, 2007

Randomize

We added the Randomize function to nitialize the random-number generator.


Private Function GetRandomNumber(ByVal lLowerBound As Long, ByVal lUpperBound As Long) As Long
Dim RandomValue As Long
' Initialize the random-number generator.
Randomize()

RandomValue = CInt(Int((lUpperBound - lLowerBound + 1) * Rnd() + lLowerBound))

Return RandomValue
End Function

No comments: