Fix the random generation problem on gcc