random generation fix