From 1a75aa1c451f0010cac32e0f441a8f1a2e86d961 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 12 Jul 2013 22:53:32 +0000 Subject: Use qrand() instead of random(). --- src/solverwindow.cc | 5 ++--- src/sudoku.cc | 8 +++----- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/solverwindow.cc b/src/solverwindow.cc index ed01048..6102c09 100644 --- a/src/solverwindow.cc +++ b/src/solverwindow.cc @@ -9,7 +9,6 @@ #include #include -#include /* * FIXME * On windows, this results in a rather awkward directory. @@ -181,7 +180,7 @@ void SolverWindow::doStep() } // compare sudoku and solution values - int index_start = (int) random() % 81; + int index_start = qrand() % 81; int index_current = index_start; do { int column = index_current % 9; @@ -210,7 +209,7 @@ void SolverWindow::doGuess() } // compare sudoku and solution values - int index_start = (int) random() % 81; + int index_start = qrand() % 81; int index_current = index_start; do { int column = index_current % 9; diff --git a/src/sudoku.cc b/src/sudoku.cc index 88695de..6074f1f 100644 --- a/src/sudoku.cc +++ b/src/sudoku.cc @@ -1,9 +1,7 @@ #include "sudoku.h" -// #include - -#include +#include Sudoku::Sudoku() { @@ -357,7 +355,7 @@ bool Sudoku::solve_search_step(int &iterations, Sudoku & solution) } // find a random empty cell - const int index_start = (int) random() % 81; + const int index_start = qrand() % 81; int index_current = index_start; int column = index_current % 9; @@ -380,7 +378,7 @@ bool Sudoku::solve_search_step(int &iterations, Sudoku & solution) // the sudoku should be solvable for one of the nine possible values for this cell // start searching with a random value - const int value_start = (int) random() % 9; + const int value_start = qrand() % 9; int value_current = value_start; do { -- cgit v1.2.3