Verify that selections are replicated correctly in randomized test

This commit is contained in:
Antonio Scandurra 2022-01-05 15:04:08 +01:00
parent 870fa5f278
commit bf044506ed
2 changed files with 43 additions and 7 deletions

View file

@ -1248,11 +1248,7 @@ impl Buffer {
self.history.group_interval = group_interval;
}
pub fn random_byte_range(
&mut self,
start_offset: usize,
rng: &mut impl rand::Rng,
) -> Range<usize> {
pub fn random_byte_range(&self, start_offset: usize, rng: &mut impl rand::Rng) -> Range<usize> {
let end = self.clip_offset(rng.gen_range(start_offset..=self.len()), Bias::Right);
let start = self.clip_offset(rng.gen_range(start_offset..=end), Bias::Right);
start..end