Returns a random number between the optional Low and High parameters
Public Class MainClass Public Shared objRandom As New System.Random(CType(System.DateTime.Now.Ticks Mod System.Int32.MaxValue, Integer)) Public Shared Function GetRandomNumber(Optional ByVal Low As Integer = 1, Optional ByVal High As Integer = 100) As Integer Return objRandom.Next(Low, High + 1) End Function Public Shared Sub Main() Dim intDiceRoll As Integer intDiceRoll = GetRandomNumber(1, 6) System.Console.WriteLine(intDiceRoll.ToString) End Sub End Class