Wednesday, April 10, 2013

[VB.NET] How to generate a random number

This can be easily done with this simple code.


Dim RandomClass As New Random()
Dim RandomNumber As Integer
RandomNumber = RandomClass.Next(1, 7) 'We want a number between 1 and 7

Just be sure to substitute the 1 and 7 with any values you would like.

No comments:

Post a Comment