title: Can't figure out why my while loop is getting stuck
body: <p>Currently working on writing code for a Windows Forms version of the card game war.  I needed a way to shuffle the list to randomize the deck.  I have already defined the lists for deck and shuffledDeck as a list of strings.</p>
  
  <p>When I run createDeck(), I had it output to a textbox in my windows form to ensure that it is infact creating the list properly.  I also had it test to ensure that deck.Count() was equal to 52</p>
  
  <pre><code>private void shuffle()
          {
              createDeck();
              shuffledDeck = deck;
              Random r = new Random();
              int randomIndex = 0;
              while (deck.Count &gt; 0)
              {
                  randomIndex = r.Next(0, deck.Count);
                  shuffledDeck.Add(deck[randomIndex]);
                  deck.RemoveAt(randomIndex);
              }
  </code></pre>
  
  <p>This is my testing that the deck is in fact shuffled</p>
  
  <pre><code>            for (int a = 0; a &lt;= 51; a++)
              {
                  textBox1.Text += " " + shuffledDeck[a];
              }
  </code></pre>
  
  <p>I would expect that I would see a shuffled deck each time however whenever I run it, Visual Studio freezes and I am have to force quit the program to exit.</p>