Generating random integers. : Math « Development « VB.Net Tutorial






Module Tester

   Sub Main()
      Dim randomObject As Random = New Random()
      Dim randomNumber As Integer
      Dim output As String = ""
      Dim i As Integer

      For i = 1 To 20
         randomNumber = randomObject.Next(1, 7)
         output &= randomNumber & " "

         If i Mod 5 = 0 Then ' is i a multiple of 5?
            output &= vbCrLf
         End If

      Next

      Console.WriteLine(output)
   End Sub 

End Module
4 1 3 4 3
5 6 2 6 5
5 3 6 4 1
6 6 3 6 3








7.15.Math
7.15.1.Math.Sqrt and Atan2
7.15.2.Math. Cos and Sin
7.15.3.Convert rectangular 3D coordinates to cylindrical coordinates.
7.15.4.Generating random integers.
7.15.5.Math.Round
7.15.6.Randomize
7.15.7.This example demonstrates Math.Max()
7.15.8.Use the Min method to return and display the smaller of two Single variables.