|
Boost Users : |
Subject: [Boost-users] Problems include the RANDOM LIBRARIES, in a console project, in Windows.
From: Alberto Aliberti (albitexx_at_[hidden])
Date: 2013-07-15 15:48:39
I used the Random libraries of Boost collection. I have implemented it in my program. A program for the chess analysis . Now, at compile time I have no problem. Everything ok, the console project is compiled without errors. During run time, the functions of Boost Random libraries, correctly generate a random number. But after a few repetitions of the loop (from 2/3 to a few tens of loops), the program crashes. The strange thing that the crash does not occur in the functions where I use the random functions, but occurs in the chess engine that does not use these functions, and thus in theory should not be influenced by it. But if I do not use the functions of Boost library and use the basic function of C + + (rand ();) I have no problems.
I work in Windows. My project is a console project compiled with VC + +2010.
Also I have wrote a test program with VC + +2010, which generates a sequence of random numbers, using Boost libraries. In this case I have no problems. Only when I implement the libraries in the chess program I have problems. So it seems that your libraries are in conflict with the chess engine. What do you recommend for the search for the cause of the problem?
The headers and the function use by me in my program:
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_smallint.hpp>
// initializes boost random generator seed
boost::random::mt19937 gen;
// random function
int ransel(int minr,int maxr) {
boost::random::uniform_smallint <> dist(minr, maxr);
return dist(gen);
}
________
Then I call the ransel() function in the loop of my program to select the chess moves.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net