title: Generating random double between 1 and 100 in C
body: <p>So this works for 10 random integers between 1 and 100:</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  
  int main()
  {
      srand(time(NULL));
  
      for (int i = 0; i &lt; 10; i++) {
          int random = rand() % 100 + 1;
          printf(&quot;The random integer is: %d\n&quot;, random);
      }
  }
  </code></pre>
  <p>However, if I want to randomly generate doubles in the range, how would I go about it? I tried changing the declaration of <code>random</code> to <code>double</code> and used casting on the RHS like this:</p>
  <pre><code>double random = (double) rand() % 100 + 1;
  </code></pre>
  <p>I hope this question is well formulated.</p>