G
Guest
I have a quick Question and I Hope some one can help or at least explain.
What is happening is that I am trying to use random numbers in an application, as per the sample test code below. When I run this code the random numbers that are displayed are all the same for abot 25 cycles and then randomize as normal.
Can some one tell me why this is or at least tell me what I am doing wrong.
Regards Glenn
Module Module1
Sub Main()
Dim rLoop As Integer
For rLoop = 1 To 100
Console.WriteLine("Return Value {0} - {1}", rLoop, RollPercent)
Next
Console.ReadLine()
End Sub
Public Function RollPercent() As Integer
Dim tmpRandom As New Random(Environment.TickCount)
Return tmpRandom.Next(1, 101)
End Function
End Module
What is happening is that I am trying to use random numbers in an application, as per the sample test code below. When I run this code the random numbers that are displayed are all the same for abot 25 cycles and then randomize as normal.
Can some one tell me why this is or at least tell me what I am doing wrong.
Regards Glenn
Module Module1
Sub Main()
Dim rLoop As Integer
For rLoop = 1 To 100
Console.WriteLine("Return Value {0} - {1}", rLoop, RollPercent)
Next
Console.ReadLine()
End Sub
Public Function RollPercent() As Integer
Dim tmpRandom As New Random(Environment.TickCount)
Return tmpRandom.Next(1, 101)
End Function
End Module