Fixed OOR error with random number generator