title: How to generate random numbers in two different arrays?(C++)
body: <p>i'm trying to generate different numbers in two different arrays and for some reason the numbers in the two arrays are the same.</p>
  
  <p>this is my code:</p>
  
  <pre><code>#define SIZE 5
  
  void main(){
  
  int* num1;
  int* num2;
  
  num1 = new int[SIZE];
  num2 = new int[SIZE];
  
  random(num1);
  random(num2);
  int i;
  for (i = 0; i &lt; SIZE; i++)
      cout &lt;&lt; num1[i];
  
  cout &lt;&lt; endl;
  
  for (i = 0; i &lt; SIZE; i++)
      cout &lt;&lt; num2[i];}
  </code></pre>
  
  <p>and the random function :</p>
  
  <pre><code>void random(int* num){
  
  int i;
  
  time_t t;
  srand((unsigned)time(&amp;t));
  
  for (i = 0; i &lt; SIZE; i++ )
      num[i] = (rand() % MAX + 1);}
  </code></pre>
  
  <p>the ouput always will be the same 5-digit number in the two array 
  (for example array 1 will be 29384 and array 2 also 29384)</p>
  
  <p>any idea how can I solve it?</p>
  
  <p>thanks.</p>