created random function