change the way to generate a random number