small changes to random number generator