add generic random_end_time and random_start_time functions