added code to reseed random number generator