to dry random_time function