diff --git a/gym/experiment.py b/gym/experiment.py index d1cb3f67..fd3dea81 100644 --- a/gym/experiment.py +++ b/gym/experiment.py @@ -106,7 +106,7 @@ def experiment( num_trajectories = 1 timesteps = traj_lens[sorted_inds[-1]] ind = len(trajectories) - 2 - while ind >= 0 and timesteps + traj_lens[sorted_inds[ind]] < num_timesteps: + while ind >= 0 and timesteps + traj_lens[sorted_inds[ind]] <= num_timesteps: timesteps += traj_lens[sorted_inds[ind]] num_trajectories += 1 ind -= 1