We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c7c52a5 commit d2e939fCopy full SHA for d2e939f
src/seq/increasing_uniform.rs
@@ -32,6 +32,12 @@ impl<R: RngCore> IncreasingUniform<R> {
32
pub fn next_index(&mut self) -> usize {
33
let next_n = self.n + 1;
34
35
+ // There's room for further optimisation here:
36
+ // gen_range uses rejection sampling (or other method; see #1196) to avoid bias.
37
+ // When the initial sample is biased for range 0..bound
38
+ // it may still be viable to use for a smaller bound
39
+ // (especially if small biases are considered acceptable).
40
+
41
let next_chunk_remaining = self.chunk_remaining.checked_sub(1).unwrap_or_else(|| {
42
// If the chunk is empty, generate a new chunk
43
let (bound, remaining) = calculate_bound_u32(next_n);
0 commit comments