diff options
author | Stijn Buys <ingar@osirion.org> | 2013-07-12 22:53:32 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2013-07-12 22:53:32 +0000 |
commit | 1a75aa1c451f0010cac32e0f441a8f1a2e86d961 (patch) | |
tree | c149638ecd5e65d02a6fd246492a4abf55ad0006 | |
parent | 1d7e740322f27e12e6c05cba85f8748605416198 (diff) |
Use qrand() instead of random().
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | src/solverwindow.cc | 5 | ||||
-rw-r--r-- | src/sudoku.cc | 8 |
3 files changed, 6 insertions, 8 deletions
@@ -2,6 +2,7 @@ INGAR'S SUDOKU SOLVER - TODO - Add Game->Settings (colors, homepath) + - Fixed homedir business on WIN32 (e.g. use Aplication data) - [SOLVED] Add confirm dialgs on Quit and New - [SOLVED] Remove sidebar buttons 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 <QVBoxLayout> #include <QPushButton> -#include <cstdlib> /* * 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 <QtGui> - -#include <cstdlib> +#include <Qt> 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 { |