Updated random number generation