| 77 | } |
| 78 | |
| 79 | fn crossover( |
| 80 | prompt1: Vec<String>, |
| 81 | prompt2: Vec<String>, |
| 82 | index1: usize, |
| 83 | index2: usize, |
| 84 | len: usize, |
| 85 | ) -> Vec<String> { |
| 86 | let mut combination = Vec::new(); |
| 87 | let first_part = &prompt1[0..index1]; |
| 88 | combination.extend_from_slice(first_part); |
| 89 | let second_part = &prompt2[index2..(index2 + len)]; |
| 90 | combination.extend_from_slice(second_part); |
| 91 | let third_part = &prompt1[(index1 + len)..]; |
| 92 | combination.extend_from_slice(third_part); |
| 93 | combination |
| 94 | } |
| 95 | |
| 96 | /// Retain the uncovered APIs, and replace with covered APIs with those chosed from High Quality Prompt. |
| 97 | fn prompt_crossover(prompt1: Vec<String>, prompt2: Vec<String>) -> Vec<String> { |