title: random number generation for the battleship game
body: <p>i need to create a battleship game for my assignment, but i don't know how to initialize an array to position a ship with the character length of size 5 and how should i put them randomly in a board of 20 rows x 60 columns. every kind help is truly appreciated, thanks. this is the original array</p>
  
  <pre><code>void startShips(int ships[][60]) {
      srand(time(NULL));
      int ship, last;
  
      for (ship = 0; ship &lt; 3; ship++) {
          ships[ship][0] = rand() % 5;
          ships[ship][1] = rand() % 5;
  
          //let's check if this shot was not tried
          //if it was, just get out of the 'do while' loop when draws a pair that was not tried 
          for (last = 0; last &lt; ship; last++) {
              if ((ships[ship][0] == ships[last][0]) &amp;&amp; (ships[ship][1] == ships[last][1]))
                  do {
                      ships[ship][0] = rand() % 5;
                      ships[ship][1] = rand() % 5;
                  } while ((ships[ship][0] == ships[last][0]) &amp;&amp; (ships[ship][1] == ships[last][1]));
          }
  
      }
  }
  </code></pre>