Make type of Rng generic in function signatures
This commit is contained in:
parent
cffe7b4f47
commit
031bdf6cd9
2 changed files with 6 additions and 6 deletions
|
@ -292,8 +292,8 @@ fn run_multi_threaded(
|
|||
}
|
||||
|
||||
|
||||
fn get_puzzle_matching_conditions(
|
||||
rng: &mut SmallRng,
|
||||
fn get_puzzle_matching_conditions<R: Rng>(
|
||||
rng: &mut R,
|
||||
difficulty: &Difficulty,
|
||||
solve_controller: &SolveController,
|
||||
max_hints: u64,
|
||||
|
|
|
@ -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<Rc<Cell>, &str> {
|
||||
fn get_random_empty_cell<R: Rng>(&self, rng: &mut R) -> Result<Rc<Cell>, &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<R: Rng>(
|
||||
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<R: Rng>(rng: &mut R) -> Grid {
|
||||
let solve_controller = SolveController {
|
||||
determine_uniqueness: true,
|
||||
search_singles: true,
|
||||
|
|
Loading…
Reference in a new issue