Updated random number functions