Fixed random function.