Fix the bug of newRandomNumber