Minor fixes

This commit is contained in:
Matthew Gordon 2025-10-18 21:31:48 -03:00
parent aa250a8145
commit fff7595b9a
3 changed files with 6 additions and 6 deletions

View File

@ -18,7 +18,7 @@ mod tests {
#[test] #[test]
fn test_first_few_values() { fn test_first_few_values() {
let expected_values = vec![ let expected_values = [
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181,
6765, 10946, 6765, 10946,
]; ];

View File

@ -1,5 +1,5 @@
use super::fibbonacci::fibbonacci; use super::fibbonacci::fibbonacci;
pub use std::rc::Rc; use std::rc::Rc;
/// [Rope](https://en.wikipedia.org/wiki/Rope_(data_structure)) data structure /// [Rope](https://en.wikipedia.org/wiki/Rope_(data_structure)) data structure
/// implementation. /// implementation.

View File

@ -45,12 +45,12 @@ pub fn generate_random_edit_sequence_with_seed(
seed: u64, seed: u64,
) -> (String, Vec<(Command, String)>) { ) -> (String, Vec<(Command, String)>) {
let mut rng = SmallRng::seed_from_u64(seed); let mut rng = SmallRng::seed_from_u64(seed);
let start_text_length = rng.random_range(0..4000); let start_text_length = rng.random_range(0..length);
let start_text = Alphanumeric.sample_string(&mut rng, start_text_length); let start_text = Alphanumeric.sample_string(&mut rng, start_text_length);
let num_steps = rng.random_range(0..1000); let num_steps = rng.random_range(0..1000);
let mut steps = Vec::with_capacity(num_steps); let mut steps = Vec::with_capacity(num_steps);
let mut current_text = start_text.clone(); let mut current_text = start_text.clone();
for i in 0..num_steps { for _ in 0..num_steps {
let current_text_length = current_text.len(); let current_text_length = current_text.len();
let command = if rng.random_bool(0.7) || current_text_length > 0 { let command = if rng.random_bool(0.7) || current_text_length > 0 {
let index = rng.random_range(0..current_text_length); let index = rng.random_range(0..current_text_length);