Private Sub RandomLongWithinRangeVerify() ' Verify the results of the RandomLongWithinRange function. 'See also: ' RandomIntegerWithinRangeVerify Subroutine ' RndBitsVerify Subroutine, et. al. Const NTries = 100000 Const NReport = 10000 Const UBnd = 100 Dim avarCnt() As Variant ReDim avarCnt(1 To UBnd) Dim lngTry As Long For lngTry = 1 To NTries If lngTry Mod NReport = 0& Then Debug.Print Format$(lngTry, "#,##0") Dim varRnd As Variant varRnd = RandomLongWithinRange(1, UBnd) If IsNull(varRnd) Then Debug.Print "Error: Try #" & lngTry & ": Result is Null" Else avarCnt(varRnd) = avarCnt(varRnd) + 1& End If Next lngTry Debug.Print IllustrateVariantVector(avarCnt) End Sub
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.