I think you can write this function as:

```rust
let mut cum = 0.0;
let data = aa.iter().map(|&(ch, p)| { cum += p; (cum, ch as u8) }).collect();
AAGen { rng: rng, data: data }
```

(with line breaking to taste.)