Fix in random function