title: How to make a random string array in vb.net
body: <p>I'm not sure if my title is exactly what I need so let me explain.</p>
  
  <p>What I'm doing is making a "simple" game that list a US State (at random into a label) and then below the label is 5 Buttons of which I am trying to change the text to the buttons to random State Capital (all of the Capitals need to be random except for the correct one) After hours of researching with no luck it seems that I am not the only one trying get help with this. If you can help it would be great!</p>
  
  <pre><code>Private Class Players
      Public Team As String
      Public Name As String
      Public Sub New(ByVal Team As String, ByVal Name As String)
          Me.Team = Team
          Me.Name = Name
      End Sub
  End Class
  
  ' Arraylist
  Dim lstCapitals As New ArrayList
  
  Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
  
      Dim list As New List(Of Players)
  
      ' Capital Names
      lstCapitals.Add("Montgomery")
      lstCapitals.Add("Juneau")
      lstCapitals.Add("Phoenix")
      lstCapitals.Add("Little Rock")
      lstCapitals.Add("Sacramento")
      lstCapitals.Add("Denver")
      lstCapitals.Add("Hartford")
  
      ' Random number generator
      Dim randomInt As New Random
  
      ' Pulls a name randomly from the list
      Dim stringname As String = lstCapitals.Item(randomInt.Next(0, 6))
      '6 = lstCapitals.Count / one line up
  
      ' Show the name
      'stateNamelbl.Show()
       'NOT SURE IF I NEEDED THIS OR NOT THATS WHY ITS COMMENTED OUT
      'Dim RandomList = From RndList In (From xitem In list Select xitem Group By xitem.Team Into First()) _
      '      Select RndList _
      '      Order By Rnd()
  
      For Each item In lstCapitals
          Randomize()
          MsgBox(item.Team)
      Next
  
  End Sub
  </code></pre>