Boost logo

Boost Users :

Subject: Re: [Boost-users] Problems include the RANDOM LIBRARIES, in a console project, in Windows.
From: Alberto Aliberti (albitexx_at_[hidden])
Date: 2013-07-16 15:09:28


Thank you, I solved the problem. It was my simple mistake. Error:  example: I have 7 moves, it are represented by a vector "moves [i]", where "i" is the index moves = n. moves. So in this case will have a vector "moves [i]" with i = 0 to 6. With the basis random function  of C, to obtain with n. moves = i = 7, a number from 0 to 6, I have write: i=rand() % i; With the Boost random functions I have to write: boost::random::uniform_int_distribution<> dist(0,i-1); I was wrong, because I wrote Boost function as C function, and not subtract a unit (I wrote (0, i) instead of (0, i-1). So I obtained the moves with an index vector from 0 to 7. But the move index 7 did not exist  and bitboard the chess engine going to crash. Now everything works ok with this correction. No problem ________________________________ Da: Edward Diener <eldiener_at_[hidden]> A: boost-users_at_[hidden] Inviato: Martedì 16 Luglio 2013 1:22 Oggetto: Re: [Boost-users] Problems include the RANDOM LIBRARIES, in a console project, in Windows. On 7/15/2013 3:48 PM, Alberto Aliberti wrote: > 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? Use the IDE debugger and when the program crashes look at the call stack to see where it crashes and why it is happening. _______________________________________________ Boost-users mailing list Boost-users_at_[hidden] http://lists.boost.org/mailman/listinfo.cgi/boost-users



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