Random.Next : Random « System « VB.Net by API






Random.Next

  

Imports System

Public Class MainClass

    Shared Sub Main(ByVal args As String())

        Dim friends() As String = {"1", "2", "3","4", "5"}


        Dim upperBound As Integer = friends.Length

        Dim random As New System.Random()

        Dim n As Integer
        For n = 1 To 10
            Dim index As Integer = random.Next(upperBound)
            Console.WriteLine(index & ": " & friends(index))
        Next
    End Sub
    

End Class

   
    
  








Related examples in the same category