Skip to main content

run_particles_range

Function run_particles_range 

Source
pub fn run_particles_range<T, N, H, M>(
    seed: u64,
    first_index: u64,
    n_particles: u64,
    chunk_size: u64,
    new_tally: N,
    history: H,
    merge: M,
) -> T
where T: Send, N: Fn() -> T + Sync, H: Fn(&mut T, &mut ParticleRng, u64) + Sync, M: FnMut(&mut T, T),
Expand description

run_particles for the global particle indices first_index..first_index + n_particles: particle first_index + k uses the stream stream(seed, first_index + k) and is passed that index.

This is how a run split into several parts (the fluence steps of a dynamic run) continues one global stream instead of replaying indices from zero. Chunks are counted from first_index, so with first_index = 0 this is exactly run_particles. Because every history depends only on (seed, index), splitting 0..n into consecutive ranges draws the same random numbers as one run of n particles.