Skip to content

Commit

Permalink
using std:: mersenne for generating hash keys
Browse files Browse the repository at this point in the history
  • Loading branch information
nescitus committed Jul 18, 2018
1 parent d296c91 commit a9473c1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions sources/src/eval_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ bool cEngine::DifferentBishops(POS *p) {

int cEngine::CheckmateHelper(POS *p) {

// TODO: make color-agnostic
int result = 0;

// KQ vs Kx: drive enemy king towards the edge
Expand Down
11 changes: 7 additions & 4 deletions sources/src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ You should have received a copy of the GNU General Public License along with thi
If not, see <http://www.gnu.org/licenses/>.
*/

#include <random>
#include <cmath>
#include <string.h>
#include "rodent.h"

U64 POS::Random64() {

static U64 next = 1;

next = next * 1103515245 + 12345;
return next;
std::random_device rd;
std::mt19937_64 e2(rd());
std::uniform_int_distribution<U64> dist(std::llround(std::pow(2, 48)), std::llround(std::pow(2, 62)));
return dist(e2);
}

void POS::Init() { // static init function
Expand Down
2 changes: 1 addition & 1 deletion sources/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sBook MainBook;

void PrintVersion() {

printf("id name Rodent III 0.256"
printf("id name Rodent III 0.257"

#if !(defined(_WIN64) || defined(__x86_64__))
" 32-bit"
Expand Down

0 comments on commit a9473c1

Please sign in to comment.