Step 1 of 6
Describe one day of arrivals
Everything is judged on the same trucks, so create them with a fixed seed.
import random
def day(seed, n=40):
rng = random.Random(seed)
t, trucks = 0.0, []
for i in range(n):
t += rng.expovariate(1 / 12) # a truck every ~12 minutes
trucks.append({"id": i, "at": round(t), "service": rng.choice([20, 30, 30, 45, 90])})
return trucks
print(day(1)[:3])
You are done whenThe same seed prints the same trucks twice.
