che versione di php hai?

cmq usa

mt_rand e non rand è meglio