removed last use of rand() function