Computes the ratio to use for length extension compared to havoc style mutations for this input.
(&self)
| 307 | /// Computes the ratio to use for length extension compared to havoc style mutations for this |
| 308 | /// input. |
| 309 | pub fn length_extension_prob(&self) -> f64 { |
| 310 | if self.metadata.rounds == 0 { |
| 311 | // First time executing the input prefer length extension. |
| 312 | return 0.9; |
| 313 | } |
| 314 | |
| 315 | const ADAPTIVE_EXTENSION_PROB: bool = true; |
| 316 | if !ADAPTIVE_EXTENSION_PROB { |
| 317 | return 0.5; |
| 318 | } |
| 319 | |
| 320 | if self.metadata.finds > 2 || self.is_import { |
| 321 | // If there multiple finds already for this input then it is likely one of them is a |
| 322 | // better length extension candidate than this input. |
| 323 | return 0.1; |
| 324 | } |
| 325 | |
| 326 | // Otherwise, slighly prefer length extension (because it generally is faster). |
| 327 | 0.6 |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | #[derive(Clone, Default, serde::Serialize, serde::Deserialize)] |