Visual Basic: Generate real random numbers

Platform:Visual Basic
Task:Generate real random numbers
If you use Dim instead of Static below you will not get random numbers. See
Public Function GetRandomNumber(ByVal Min As Integer, ByVal Max As Integer) As Integer
    ' by making Generator static, we preserve the same instance '
    ' (i.e., do not create new instances with the same seed over and over) '
    ' between calls '
    Static Generator As System.Random = New System.Random()
    Return Generator.Next(Min, Max)
End Function
Back to Index