little update to random function