/// Select a prog from `corpus` and splice it with calls in the `ctx` randomly.
Select a prog from `corpus` and splice it with calls in the `ctx` randomly.
Select a prog from ` corpus ` and splice it with calls in the ` ctx ` randomly .
pub fn splice(ctx: &mut Context, corpus: &CorpusWrapper, rng: &mut RngType) -> bool {
    if ctx.calls.is_empty() || ctx.calls.len() > prog_len_range().end || corpus.is_empty() {
        return false;
    }
    let p = corpus.select_one(rng).unwrap();
    let mut calls = p.calls;
    // mapping resource id of `calls`, continue with current `ctx.next_res_id`
    mapping_res_id(ctx, &mut calls);
    restore_partial_ctx(ctx, &calls);
    let idx = rng.gen_range(0..=ctx.calls.len());
    debug_info!(
        "splice: splicing {} call(s) to location {}",
        calls.len(),
        idx
    );
    ctx.calls.splice(idx..idx, calls);
    true
}
pub fn splice ( ctx : & mut Context , corpus : & CorpusWrapper , rng : & mut RngType ) -> bool { if ctx . calls . is_empty ( ) || ctx . calls . len ( ) > prog_len_range ( ) . end || corpus . is_empty ( ) { return false ; } let p = corpus . select_one ( rng ) . unwrap ( ) ; let mut calls = p . calls ; // mapping resource id of `calls`, continue with current `ctx.next_res_id` mapping_res_id ( ctx , & mut calls ) ; restore_partial_ctx ( ctx , & calls ) ; let idx = rng . gen_range ( 0 ..= ctx . calls . len ( ) ) ; debug_info ! ( " " calls len ( ) idx ) ; ctx . calls . splice ( idx .. idx , calls ) ; true }
Select a prog from `corpus` and splice it with calls in the `ctx` randomly.
Select a prog from ` corpus ` and splice it with calls in the ` ctx ` randomly .
ctx
&mut Context
corpus
&CorpusWrapper
rng
&mut RngType