title: Multidimensional array with rand()
body: <p>I want to create a multidimensional array with just two values : 0 or 1.</p>
  
  <p>I use the srand/rand functions but array contains only 0.
  Here is the code :</p>
  
  <pre><code>#define NB_LINE 4
  #define NB_COLUMN 11
  int tab[NB_LINE][NB_COLUMN] ;  // global variable
      void generate() {
      srand((unsigned int)time(NULL));
  
      int n, i, j;
      for(n = 0; n &lt; NB_LINE*NB_COLUMN; ++n){
          do
          {
              i = rand() % NB_LINE;
              j = rand() % NB_COLUMN;
          }
          while (tab[i][j] != 0);
          tab[i][j] = 1 ;
      }
  }
  </code></pre>
  
  <p>I don't know how to solve this problem ?</p>
  
  <p>thanks !</p>
  
  <p>Edit : Thanks for your answers. Do you think it's possible with rand() to have juste one "1" per column and others spots contain only 0 ? </p>