Tag Archives: random numbers

Generate Random Numbers by using VB.NET and Higher

Shows how to use Visual Bas.NET through VB 2005 and Visual Basic 201 to generate random numbers using the Random class in the DotNet Framework


        'Instantiate a new random class
        Dim r As Random = New Random
        'Get a random number within the full range of a integer value.
        'Generates a random number from 0 up to the set maximum. It is set not to return a number larger than 20.
        'Generates a random number within the minumum and maximum numbers that are specified. IT will not return 
        'a number lower than the setMinumum, or return a number higher than the setMax.
        MsgBox(r.Next(10, 15))