title: how to create a random 2d array in C with values repeating only twice
body: <p>im very new to c programming and have done only if/else, loops, arrays, pointers, functions and structs. I would be very glad if anyone could tell me how to create a 2d array which would contain randomized with time, but would have values that are repeated only twice...</p>
  
  <p>meaning for example:</p>
  
  <pre><code>1 2 3 6
  8 7 4 5
  7 5 6 3
  2 1 4 8
  </code></pre>
  
  <p>actually i need the array to be 6x6 and so far i have come to this stage which does not work:</p>
  
  <pre><code>int x,y;
  int i,j;
  
  srand (time(NULL));
  
  for ( x=0 ; x&lt;6 ; x++){
      for ( y=0 ; y&lt;6 ; y++) {
          sBoard[x][y] = rand() %36;          /*randomization*/
  
          for ( i=0 ; i&lt;6 ; i++){  /*trying to create an unique array*/
              for ( j=0 ; j&lt;6 ; j++) {
                  if ((sBoard[x][y] == sBoard[i][j])) {
                      x--;
                      y--;
                  }
              }
          }
          printf ("%i",sBoard[x][y]);
      }
      printf("\n");
  }
  </code></pre>
  
  <p>=======================================================================================
  my lecturer asked me to try and use an if function to check whether the value is repeating anywhere else on the matrix... that is why im using an 'if'...i would be very grateful if you could help me... 
  thank you in advance...</p>