samedi 8 août 2015

Random Number generators in C++ and Fortran

I am working on a project and need to convert a Fortran program into C++. Part of the Fortran program is a random number generator subprogram. I have converted it to C++ using a class. The problem is the following:

When I compare the results using the two programs (initialized with the same seed), the first 800 or so random numbers match, but when I try to generate more, I find that the numbers gradually differ. I have no idea why this might happen. I have tried to define all integer variables as long in the c++ program, but it does not help. Does some know what the problem might be. I can post the C++ and fortran codes if necessary.

Thanks




Aucun commentaire:

Enregistrer un commentaire