Generation

generate functionMon, 08 May 2023

To model how long Amir will wait for a back-up using a continuous uniform distribution, save his lowest possible wait time as min_time and his longest possible wait time as max_time. Remember that back-ups happen every 30 minutes.

def sample_waiting_times(n_times): # Initialize waiting times waiting_times = [] for _ in range(n_times): # Sample waiting time from the uniform distribution waiting_time = np.random.uniform(low=min_time, high=max_time) waiting_times.append(waiting_time) return waiting_times

Questions about programming?Chat with your personal AI assistant