title: How do I keep the random generated numbers from repeating inside the array?
body: <p>I´m very new at coding and I want to create a programm that generates 6 random numbers in an array, and repeat the process 20 times. So far, I can get the array to fill with random numbers and to do the 20 loops but I can´t get the random numbers from repeating inside the array. Any tips?</p>
  <p>Code:</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  
  int main()
  {
      printf(&quot;\n5.1 Lottoziehung 6 aus 49 \n\n&quot;);
  
      int Ziehung[6]; 
      int Zufallszahl; //random variable
      srand((unsigned) time(0));
      for (int i=1; i&lt;=20; i++)//Iterationen
      {
          printf(&quot;Ziehung %i: &quot;,i); //Ziehungen Anzahl (the 20 loops)
  
                      for (int j=0;j&lt;=5;j++){ //Array
  
                          int Zufallszahl=(rand() % 49)+1; //random num gen
  
                              if (Zufallszahl&gt;0){
                              Ziehung[j]=Zufallszahl; //Array; Zahl innerhalb Ziehung widerholt
                              printf(&quot; %i,&quot;,Ziehung[j]);
                              }//if
                              else {
                              j-1;
                              }//else
                  }//for
  
                   printf(&quot;\n&quot;);
   }
  
      return 0;
  }
  </code></pre>