title: How can I create an array of random numbers in C++
body: <p>Instead of The ELEMENTS being 25 is there a way to randomly generate a large array of elements....10000, 100000, or even 1000000 elements and then use my insertion sort algorithms.  I am trying to have a large array of elements and use insertion sort to put them in order and then also in reverse order.  Next I used clock() in the time.h file to figure out the run time of each algorithm.  I am trying to test with a large amount of numbers.  </p>
  
  <pre><code>#define ELEMENTS 25
  
  void insertion_sort(int x[],int length);
  void insertion_sort_reverse(int x[],int length);
  
  int main()
  {
    clock_t tStart = clock();
    int B[ELEMENTS]={4,2,5,6,1,3,17,14,67,45,32,66,88,
                 78,69,92,93,21,25,23,71,61,59,60,30};
    int x;
  
    cout&lt;&lt;"Not Sorted: "&lt;&lt;endl;
    for(x=0;x&lt;ELEMENTS;x++)
         cout&lt;&lt;B[x]&lt;&lt;endl;
  
     insertion_sort(B,ELEMENTS);
     cout &lt;&lt;"Sorted Normal: "&lt;&lt;endl;
    for(x=0;x&lt;ELEMENTS;x++)
         cout&lt;&lt; B[x] &lt;&lt;endl;
  
    insertion_sort_reverse(B,ELEMENTS);
    cout &lt;&lt;"Sorted Reverse: "&lt;&lt;endl;
    for(x=0;x&lt;ELEMENTS;x++)
         cout&lt;&lt; B[x] &lt;&lt;endl;
  
    double seconds = clock() / double(CLK_TCK);
    cout &lt;&lt; "This program has been running for " &lt;&lt; seconds &lt;&lt; " seconds." &lt;&lt; endl;
    system("pause");
    return 0;
  }
  </code></pre>