Skip to content

Commit

Permalink
Address some feedback from #105, making sure synthetic_od_requests pr…
Browse files Browse the repository at this point in the history
…oduces enough valid requests
  • Loading branch information
dabreegster committed Feb 7, 2025
1 parent d2e6c85 commit c6b5c67
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backend/src/od.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ pub fn synthetic_od_requests(map: &MapModel) -> Vec<(IntersectionID, Intersectio

let mut rng = WyRand::new_seed(42);
let mut requests = Vec::new();
for _ in 0..num_requests {
while requests.len() != num_requests {
let i1 = IntersectionID(rng.generate_range(0..map.intersections.len()));
let i2 = IntersectionID(rng.generate_range(0..map.intersections.len()));
requests.push((i1, i2, 1));
if i1 != i2 {
requests.push((i1, i2, 1));
}
}
requests
}

0 comments on commit c6b5c67

Please sign in to comment.