' Ch 7 Demo #9
' Mr Minich
' This program illustrates the use of the Rnd function
' and the Randomize statement to generate pseudorandom numbers.
Option Explicit
Private Sub Command1_Click()
Label1.Caption = sngRandomNum(2.5, 9.99)
Label2.Caption = intRandomInt(1, 10)
End Sub
Private Function intRandomInt(ByVal intLow As Integer, ByVal intHigh As Integer) As Integer
intRandomInt = Rnd * (intHigh - intLow) + 1
End Function
Private Function sngRandomNum(ByVal sngLow As Integer, ByVal sngHigh As Integer) As Single
sngRandomNum = Rnd * (sngHigh - sngLow) + 1
End Function