Generate a Random Number Between Two Values

May 16th, 2007

Here's a quick and easy VB function to generate a random number between two values that you specify.

Public Function GetRandomNumber(ByVal iMinValue As Integer, ByVal iMaxValue As Integer) As Integer
    Dim r As New Random(System.DateTime.Now.Millisecond)

    Return r.Next(iMinValue, iMaxValue)
End Function

Posted in Visual Basic | No Comments




No Comments yet »

RSS feed for comments on this post. TrackBack URI

Leave a comment



(C) by Virgilio Adriano. All rights reserved. Powered by WordPress.
Entries and comments feeds.
It took 0.380 seconds to load this page.