(s: &str)
| 501 | return Err(MicrostructuralError::NanInArray); |
| 502 | } |
| 503 | let table = ascii_table(); |
| 504 | let alphabet = &table[..num_letters]; |
| 505 | let mut sorted = array.to_vec(); |
| 506 | sorted.sort_by(f64::total_cmp); |
| 507 | let mut out: Vec<(f64, char)> = Vec::new(); |
| 508 | for (q, letter) in linspace(0.01, 1.0, alphabet.len()).iter().zip(alphabet.iter()) { |
| 509 | let idx = ((*q) * (sorted.len() as f64 - 1.0)).round() as usize; |
| 510 | out.push((sorted[idx], *letter)); |
| 511 | } |
no outgoing calls
no test coverage detected