1. <?php
  2.  
  3. $error = 0;
  4.  
  5. for ($x = 1; $x <= 100000; $x++) {
  6.   $num = substr(hexdec(substr(hash("md5", md5("test") . random_bytes(mt_rand(1, 50))), 0, 10)), 0, 10);
  7.   if (strlen($num) != 10) {
  8.       $error += 1;
  9.   }
  10.   //echo "<p>" . strlen($num) . " - $num</p>";
  11. }
  12.  
  13. echo "<p>$error</p>";
  14.