title: Filling an array with random numbers in a range in C
body: <p>What I try to do is to create a function thay allocates memory for an array and fills it up with random numbers in a specified range(in my case 50-76).<code>srand</code>is in the main and I use the <code>&lt;time.h&gt;</code> header. </p>
  
  <pre><code>unsigned* randomgen(int size, unsigned max, unsigned min)
  {
      int i;
      unsigned* arr = (unsigned*)malloc(size * sizeof(unsigned));
      for (i = 0; i &lt; size; i++) {
          arr[i] = (rand() % (max - min + 1)) + min;
          printf("%d ", arr[i]);
      }
      return arr; 
  }
  </code></pre>
  
  <p>I want to get numbers like <code>60 52 68 ...</code>.
  What is happening is that the numbers generated look something like<code>3526 4582 13224 ...</code>.
  This is only happening in this function.When I do it in <code>main</code> I get the wanted results.</p>