X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbook.cpp;h=a34d17b74ca7dc13c46c4ab0535b9d0d639356c3;hp=c9a2e9c973ee0f8f75baa893994194d110c567d7;hb=f5e28ef5127ff29310f9c2e8e321eb24214f2439;hpb=287556f97d54c87b3a973e22e133a9d09b62676f diff --git a/src/book.cpp b/src/book.cpp index c9a2e9c9..a34d17b7 100644 --- a/src/book.cpp +++ b/src/book.cpp @@ -32,7 +32,6 @@ #include #include "book.h" -#include "mersenne.h" #include "movegen.h" using namespace std; @@ -343,6 +342,13 @@ namespace { //// Functions //// +// C'tor. Make random number generation less deterministic, for book moves +Book::Book() { + + for (int i = abs(get_system_time() % 10000); i > 0; i--) + RKiss.rand32(); +} + /// Destructor. Be sure file is closed before we leave. @@ -435,7 +441,7 @@ Move Book::get_move(const Position& pos, bool findBestMove) { // high score it has more probability to be choosen then a one with // lower score. Note that first entry is always chosen. scoresSum += score; - if (int(genrand_int32() % scoresSum) < score) + if (int(RKiss.rand32() % scoresSum) < score) bookMove = entry.move; } if (!bookMove)