This commit is contained in:
Simon Gardling 2021-04-01 09:29:32 -04:00
parent 953c540263
commit a613b6e9b2

View File

@ -158,7 +158,7 @@ impl Model {
diffusivity: usize, diffusivity: usize,
) -> Self { ) -> Self {
let particles_per_grid = (n_particles as f64 / n_populations as f64).ceil() as usize; let particles_per_grid = (n_particles as f64 / n_populations as f64).ceil() as usize;
let n_particles = particles_per_grid * n_populations; let _n_particles = particles_per_grid * n_populations;
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
@ -180,7 +180,7 @@ impl Model {
} }
let mut grids: Vec<Grid> = Vec::new(); let mut grids: Vec<Grid> = Vec::new();
for _ in (0..n_populations) { for _ in 0..n_populations {
let agents = (0..particles_per_grid) let agents = (0..particles_per_grid)
.map(|i| Agent::new(width, height, i / particles_per_grid, &mut rng, i)).collect(); .map(|i| Agent::new(width, height, i / particles_per_grid, &mut rng, i)).collect();
grids.push(Grid::new(width, height, &mut rng, agents)); grids.push(Grid::new(width, height, &mut rng, agents));