title: Generate random between [0, 1)
body: <p>I want to generate a random float value between 0 and 1 excluding 1, I.e. <code>[0, 1)</code>. I've searched a lot but I couldn't find an answer of this. I've tried the following trick however it generates a negative values </p>
  
  <pre><code>(double)rand()/(double)RAND_MAX-1;
  </code></pre>