def sample_batch_trajectories(self, rollout_length, history_length):
<EOL>if self.current_size < self.buffer_capacity:<EOL><INDENT>if rollout_length + <NUM_LIT:1> > self.current_size:<EOL><INDENT>raise VelException("<STR_LIT>")<EOL><DEDENT>return np.random.choice(self.current_size - rollout_length) + rollout_length - <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>if rollout_length + history_length > self.current_size:<EOL><INDENT>raise VelException("<STR_LIT>")<EOL><DEDENT>candidate = np.random.choice(self.buffer_capacity)<EOL>forbidden_ones = (<EOL>np.arange(self.current_idx, self.current_idx + history_length + rollout_length - <NUM_LIT:1>)<EOL>% self.buffer_capacity<EOL>)<EOL>while candidate in forbidden_ones:<EOL><INDENT>candidate = np.random.choice(self.buffer_capacity)<EOL><DEDENT>return candidate<EOL><DEDENT>
Return indexes of next sample