added time(0) to randomize the seed.