title: problem with generating rand number between 0 and 1 using C language
body: <p>I am trying to generate some numbers with the rand() function like below:</p>
  
  <pre><code>int main()
  {
      int i=0
      for(i=0;i&lt;20;i++)
      {
      printf("%f\n",rand_md());
      }
      return 0;
  }
  
  
  
  float rand_md()
  {
      return (float)rand()/(RAND_MAX+1.0);
  }
  </code></pre>
  
  <p>But when I run gcc rand.c, I get the error like below:
  rand.c: In function ‘main’:
  rand.c:21: warning: format ‘%f’ expects type ‘double’, but argument 2 has type ‘int’
  rand.c: At top level:
  rand.c:36: error: conflicting types for ‘rand_md’
  rand.c:21: error: previous implicit declaration of ‘rand_md’ was here</p>
  
  <p>What's wrong with my code?</p>
  
  <p>Best Regards,</p>