Random.Next Method (Int32, Int32) returns a random number within a specified range. : Random « Development « VB.Net






Random.Next Method (Int32, Int32) returns a random number within a specified range.

 

Module Example
   Public Sub Main()
      Dim rnd As New Random()

      Console.WriteLine("20 random integers from -100 to 100:")
      For ctr As Integer = 1 To 20
         Console.Write("{0,6}", rnd.Next(-100, 101))
         If ctr Mod 5 = 0 Then Console.WriteLine()
      Next

   End Sub
End Module

   
  








Related examples in the same category

1.Generate a Random NumberGenerate a Random Number
2.Random numberRandom number
3.Generating Random Numbers between the optional Low and High parameters
4.Returns a random number between the optional Low and High parameters
5.Random Class represents a pseudo-random number generator
6.Generate and display 5 random byte (integer) values
7.Generate and display 5 random integers
8.Generate and display 5 random integers between 0 and 100
9.Generate and display 5 random integers from 50 to 100
10.Generate and display 5 random floating point values from 0 to 1
11.Generate and display 5 random floating point values from 0 to 5
12.Create Random class, using the specified seed value.
13.Random.Next Method returns a nonnegative random number less than the specified maximum.
14.No bound random number
15.Generate random numbers with an upper bound specified
16.Generate random numbers with both bounds specified
17.20 random integers from 1000 to 10000
18.20 random integers from 1 to 10
19.Random.NextBytes fills the elements of a specified array of bytes with random numbers.
20.Random.NextDouble returns a random number between 0.0 and 1.0.
21.Distribution of Random Numbers
22.IPHostEntry: Internet host address information.