Fix bad stagger interval calculation.

Was using the interval from mission start to latest rather than from
earliest to latest, so this could sometimes be off by a bit and cause
us to not generate enough start times.
This commit is contained in:
Dan Albert 2020-11-07 16:25:56 -08:00
parent e8feded4c3
commit 11604671f8

View File

@ -490,7 +490,7 @@ class CoalitionMissionPlanner:
def stagger_missions(self) -> None:
def start_time_generator(count: int, earliest: int, latest: int,
margin: int) -> Iterator[timedelta]:
interval = latest // count
interval = (latest - earliest) // count
for time in range(earliest, latest, interval):
error = random.randint(-margin, margin)
yield timedelta(minutes=max(0, time + error))