title: Error in my random 32 bit generation
body: <p>I want to generate 32 bit random number using the following C code. For small 'LOOP', it works well. But for larger LOOP>1024*1024*4, all final value becomes 1/32. Can you kindly explain where is problem in the following code. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;time.h&gt;
  #include &lt;stdlib.h&gt;
  #include&lt;math.h&gt;
  
  #define ul unsigned int
  #define ull unsigned long long 
  
  
  
  ul myrand32(){
  
          ul temp=4294967296.0*drand48();
  
          return temp;
  
  }
  
  int main(){
  
  ul temp;
  ull i,j,s,Z, LOOP=1024*1024*1024;
  double A[32];
  srand(time(NULL));
  srand48(time(NULL));
  
  for(i=0;i&lt;32;i++)
     A[i]=0;
  
  for(i=0;i&lt;LOOP;i++){
                      temp=myrand32();      
  
                      j=temp%32;
                      A[j]+=1;
  
  
                 }
  
  for(j=0;j&lt;32;j++)
      printf("%lf   %llu   %lf\n", A[j]/i,j,1.0/32);
  
  }
  </code></pre>