title: PHP Random Float Number Generator
body: <p>I am new to PHP so sorry if this is messy, I have looked around StackOverflow but I am unable to find anything that fits my need.</p>
  
  <p>I am trying to create a random float number list. But the problem I am having is everytime I run the list it prints out the same number. Can anyone explain why and if there is a way to get different numbers each iteration.</p>
  
  <p>Thank You for any help.</p>
  
  <pre><code>&lt;?php
      function frand($min, $max, $decimals = 0) {
          mt_srand(microtime());
  
          $scale = pow(10, $decimals);
  
          return mt_rand($min * $scale, $max * $scale) / $scale;
      }
  
      for ($x = 1; $x &lt;= 45; $x++) {
          echo frand(1, 17, 8) . "&lt;br/&gt;";
      } 
  ?&gt;
  </code></pre>