Fix wrong interval for random function