Fix random number generator