bug fix for prophecies

This commit is contained in:
deadvey 2025-01-05 03:14:15 +00:00
parent 96b28a74c2
commit 31b95ad12e

View File

@ -19,9 +19,14 @@ fn main() -> io::Result<()> {
let lines_in_string = split_string.len(); let lines_in_string = split_string.len();
// Iterate for "number_of_lines" and each time pick a random line in the file // Iterate for "number_of_lines" and each time pick a random line in the file
let mut previous_line_index = 0;
for _i in 0..number_of_lines { for _i in 0..number_of_lines {
let line_index = rand::thread_rng().gen_range(0..lines_in_string); // Pick random line let line_index = rand::thread_rng().gen_range(0..lines_in_string); // Pick random line
if split_string[previous_line_index] == split_string[line_index] {
continue;
}
println!("{}",split_string[line_index]); // Print the random line println!("{}",split_string[line_index]); // Print the random line
previous_line_index = line_index;
} }
Ok(()) Ok(())