title: How can I generate a random float number?
body: <p>I'm trying to generate a random float number between 0 and 1.</p>
  
  <pre><code>0.0f + rand() % 1.0f;
  </code></pre>
  
  <p>But I get the following error after I compile with GCC:</p>
  
  <pre><code>error: invalid operands to binary % (have ‘int’ and ‘float’)
  </code></pre>