pub fn sample<R: Rng>(
buffer: &ReplayBuffer,
batch_size: usize,
rng: &mut R,
) -> ReplayBatchExpand description
Sample batch_size transitions uniformly with replacement from the
filled portion of buffer.
Uniform with-replacement matches the canonical DQN recipe and is what makes the sampler O(1) per draw. For small batches relative to buffer size the difference vs without-replacement is negligible.
ยงPanics
Panics if buffer.is_empty() or batch_size == 0.