diff --git a/include/class.misc.php b/include/class.misc.php index b5ce887053eba3be836dbc976aa23447c2b8ca80..57c18a8df5f0456bd8cce201c7c003ae52fdcee4 100644 --- a/include/class.misc.php +++ b/include/class.misc.php @@ -52,12 +52,14 @@ class Misc { } /* Helper used to generate ticket IDs */ - function randNumber($len=6,$start=false,$end=false) { - - $start=(!$len && $start)?$start:str_pad(1,$len,"0",STR_PAD_RIGHT); - $end=(!$len && $end)?$end:str_pad(9,$len,"9",STR_PAD_RIGHT); + function randNumber($len=6) { + $number = ''; + for ($i=0; $i<$len; $i++) { + $min = ($i == 0) ? 1 : 0; + $number .= mt_rand($min, 9); + } - return mt_rand($start,$end); + return (int) $number; } /* misc date helpers...this will go away once we move to php 5 */