title: Generate random number in [7000000000, 9999999999]
body: <p>I am new to c++, and i am writing a program for generating random phone number. But the program is giving same random number. 
  I have also used </p>
  
  <pre><code>srand (time (null));
  </code></pre>
  
  <p>and </p>
  
  <pre><code>srand (time (0));
  </code></pre>
  
  <p>My code is as follows</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  #include &lt;ctime&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int randomno (int array [], int size)
  {
  
      array [0]=rand()%3+7;
      for (int i=1; i&lt;size; i++)
      {
          array [i]=rand()%10;
      }
      int phoneno=array[size];
      return phoneno;
  }
  int main ()
  {
      srand (time (NULL));
      int no[10];
      cout &lt;&lt; "Random phone no is " &lt;&lt; randomno (no, 10);
  }
  </code></pre>
  
  <p>This program should show numbers in the format (9 or 8 or 7 then 9 more digits).
  The program below runs well and will give you an idea what i want to do.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;cstdlib&gt;
  #include &lt;ctime&gt;
  
  using namespace std;
  
  int main ()
  {
      srand (time (NULL));
      cout &lt;&lt; "The Random phone No. is ";
      int d1, d2, d3, d4, d5, d6, d7, d8, d9, d10;
      d1=rand()%3+7;
      d2=rand()%10;
      d3=rand()%10;
      d4=rand()%10;
      d5=rand()%10;
      d6=rand()%10;
      d7=rand()%10;
      d8=rand()%10;
      d9=rand()%10;
      d10=rand()%10;
      cout &lt;&lt; d1&lt;&lt;d2&lt;&lt;d3&lt;&lt;d4&lt;&lt;d5&lt;&lt;d6&lt;&lt;d7&lt;&lt;d8&lt;&lt;d9&lt;&lt;d10;
  }
  </code></pre>
  
  <p>But later i decided to use Arrays and functions.</p>
  
  <p>Help me out.</p>