modify the random number generate method