title: Memory Match Game ++ How to randomize chars in an array
body: <p>Hello I'm having issue with this assignment. My program is a Memory Match Game in C++, and it runs, however I need to get the chars in my 2D array to shift positions after every time the user inputs a valid or invalid response. They're staying at the same position as initialized. I've tried multiple ideas but have come to no conclusions. Even some hints that might help are appreciated.  </p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;cstdlib&gt;
  #include&lt;ctime&gt;
  #include&lt;string&gt;
  using namespace std;
  
  class Game //Memory Match Game
  {
  private:
       char cards[4][4] = {   { '@', '#', '$', '%' },
                          {'^', '&amp;', '*', '+'},
                          {'@', '#', '$', '%'},
                          {'^', '&amp;', '*', '+' } };
  
  char deck[16] = { '@','#', '$', '%', '^','&amp;', '*', '+' }; //not being used atm
  int r1, r2, c1, c2;
  public:
      Game()
      {
          r1 = 0; r2 = 0; c1 = 0; c2 = 0;
      }
  
  void begin()
  {
      srand((unsigned)time(NULL));
      for (int x = 0; x &lt; 4; x++) //begin designating cards 
      {
          for (int y = 0; y &lt; 4; y++)
          {
              cards[rand() % x][rand() % y]; // &lt;:::::[:::] FIX
              cout &lt;&lt; " " &lt;&lt; cards[x][y] &lt;&lt; " ";
          }
          cout &lt;&lt; endl;
      }
      cout &lt;&lt; " \n    1 2 3 4\t\n";
      cout &lt;&lt; "   ";
      for (int x = 0; x &lt;= 8; x++)
      {
          cout &lt;&lt; "_";
      }
      cout &lt;&lt; endl;
  
      for (int x = 0; x &lt; 4; x++) //appropriate positioning
      {
          cout &lt;&lt; x + 1 &lt;&lt; " | ";
          for (int y = 0; y &lt; 4; y++)
          {
              cout &lt;&lt; "? ";
          }
          cout &lt;&lt; endl;
      }
      cout &lt;&lt; endl;
      input();
  }
  
  void input()
  {
      srand(time(0));
      cout &lt;&lt; "Please type in the row and column of choice.\n"; //begin user play
      cin &gt;&gt; r1;
      cin &gt;&gt; c1;
      cout &lt;&lt; "Please type in the row and column of choice\n";
      cin &gt;&gt; r2;
      cin &gt;&gt; c2;
  
      r1--; r2--; c1--; c2--;
      cout &lt;&lt; "     1 2 3 4\n";
      cout &lt;&lt; "   ";
      for (int x = 0; x &lt;= 8; x++)
      {
          cout &lt;&lt; "_";  
      }
      cout &lt;&lt; endl;
      for (int x = 0; x &lt; 4; x++)
      {
          cout &lt;&lt; x + 1 &lt;&lt; " | ";
          for (int y = 0; y &lt; 4; y++)
          {
              if ((x == r1) &amp;&amp; (y == c1))
              {
                  cout &lt;&lt; cards[x][y] &lt;&lt; " ";
              }
              else if ((x == r2) &amp;&amp; (y == c2))
              {
                  cout &lt;&lt; cards[x][y] &lt;&lt; " ";
              }
              else cout &lt;&lt; "? ";
          }
          cout &lt;&lt; endl;
      }
      match();
  
  }
    void match()
    {
        if (cards[r1][c1] == cards[r2][c2])
      {
          cout &lt;&lt; "Valid Match!\n";
          input();
      }
       else
          cout &lt;&lt; "Invalid Match!\n";
          input();
  
  }
  
  };
  
   int main()
  {
       Game memoryMatch;
      memoryMatch.begin();
  
      system("pause");
   }
  </code></pre>