Fix random number generator lock-up