shouldn't you replace rand() by time?