I have resolved this with code based on System.Random. Left the original as a conditional.
Code:Const MBIG As Double = 1.0# / Integer.MaxValue Private Function ISample() As Double Dim rv As Double = 0 #Const Methd = "1" ' "2" Dim I1 As Integer = Me.Next 'get random integer between 0 and Integer.MaxValue #If Methd = "1" Then rv = I1 * MBIG #ElseIf Methd = "2" Then Dim I2 As Integer = Me.Next If I1 > I2 Then rv = I2 / I1 ElseIf I2 > I1 Then rv = I1 / I2 ElseIf I1 <> Integer.MaxValue Then rv = I2 / (I1 + 1) Else rv = (I2 - 1) / I1 End If #End If Return rv End Function




Reply With Quote