From 031bdf6cd9332ff0ef158795440d1adbef31688a Mon Sep 17 00:00:00 2001 From: Joel Therrien Date: Fri, 16 Sep 2022 21:39:54 -0700 Subject: [PATCH] Make type of Rng generic in function signatures --- src/bin/generator.rs | 4 ++-- src/generator.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bin/generator.rs b/src/bin/generator.rs index c29f169..83d748f 100644 --- a/src/bin/generator.rs +++ b/src/bin/generator.rs @@ -292,8 +292,8 @@ fn run_multi_threaded( } -fn get_puzzle_matching_conditions( - rng: &mut SmallRng, +fn get_puzzle_matching_conditions( + rng: &mut R, difficulty: &Difficulty, solve_controller: &SolveController, max_hints: u64, diff --git a/src/generator.rs b/src/generator.rs index 6464173..2d6c18f 100644 --- a/src/generator.rs +++ b/src/generator.rs @@ -8,7 +8,7 @@ use std::rc::Rc; pub static mut DEBUG: bool = false; impl Grid { - fn get_random_empty_cell(&self, rng: &mut SmallRng) -> Result, &str> { + fn get_random_empty_cell(&self, rng: &mut R) -> Result, &str> { // Idea - put all empty cells into a vector and choose one at random // If vector is empty we return an error @@ -125,8 +125,8 @@ impl Section { } } -pub fn generate_grid( - rng: &mut SmallRng, +pub fn generate_grid( + rng: &mut R, solve_controller: &SolveController, ) -> (Grid, u64, SolveStatistics) { let mut grid = generate_completed_grid(rng); @@ -179,7 +179,7 @@ pub fn generate_grid( } // We generate a completed grid with no mind for difficulty; afterward generate_puzzle will take out as many fields as it can with regards to the difficulty -fn generate_completed_grid(rng: &mut SmallRng) -> Grid { +fn generate_completed_grid(rng: &mut R) -> Grid { let solve_controller = SolveController { determine_uniqueness: true, search_singles: true,