Skip to main content
Home / Code Snippets / PHP / Make Random Number

Make Random Number

function getRandomId($min = NULL, $max = NULL) {
       if (is_numeric($min) && is_numeric($max)) {
               return mt_rand($min, $max);
       }
       else {
               return mt_rand();
       }
}
icon-link icon-logo-star icon-search icon-star