Tutorial by Examples

Dim rng As New Random() This declares an instance of the Random class called rng. In this case, the current time at the point where the object is created is used to calculate the seed. This is the most common usage, but has its own problems as we shall see later in the remarks Instead of allowin...
The following example declares a new instance of the Random class and then uses the method .Next to generate the next number in the sequence of pseudo-random numbers. Dim rnd As New Random Dim x As Integer x = rnd.Next The last line above will generate the next pseudo-random number and assign ...

Page 1 of 1