Module Module1 Sub Main() Dim pingCounter As Integer = 0 pingCounter = generateRandom(pingCounter) Console.WriteLine("The server was pinged " & pingCounter & " time(s).") Console.WriteLine("Press Any key to exit...") Console.ReadKey() End Sub End Module Module RNG Function generateRandom(ByRef pingCounter As Integer) As Integer Dim RN As Integer = 0 Dim Count As Integer = 0 For Count = 1 To 200 RN = Int(Rnd() * 20 + 1) If RN <> 5 Then Console.WriteLine("Random number was " & RN & " this was not the target number.") Console.WriteLine("Re-rolling in 1000 ms...") ElseIf RN = 5 Then pingMe() pingCounter = pingCounter + 1 End If System.Threading.Thread.Sleep(1000) Next Return pingCounter End Function End Module Module Ping Sub pingMe() Shell("Ping.exe 127.0.0.1", , True) Console.Out.WriteLine(" ") End Sub End Module
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)