modify the random function