Hi there, I'm currently writing a program that accepts/rejects moves based on some other data (Monte Carlo simulation). My problem is with the Mersenne twister I am using to generate random numbers in the program. I can't pretend that my C++ knowledge is anywhere near that of the code written for Mersenne, so I'm only really just using it.
So I have two compiler files where I want to use the random number generator. The main file is as follows:
// Random seed
srand ( (unsignedint)time(0) );
seedmain=time(NULL);
// Starts the seqeunce of random numbers
CRandomMersenne RanGen(seedmain);
CRandomMersenne *pRanGen;
pRanGen=&RanGen;
double random;
for (int i = 0; i < n_atoms; i++)
{
coords[i] = newdouble[3];
random=RanGen.Random();
coords[i][0] = random*box_size[0];
random=RanGen.Random();
coords[i][1] = random*box_size[1];
random=RanGen.Random();
coords[i][2] = random*box_size[2];
}
Which works fine by itself. The problem is that I have now written another file that contains functions which are then called inside this main file. The section in this other file that is relevant is:
Which returns the error "error C2082: redefinition of formal parameter 'pRanGen'". I've tried changing the above code a few times but just get errors like RanGen is undefined. Any help would be much appreciated.