change rand() to mt_rand()