Hi, for the piece of code I'm working on at the moment I've encountered a fairly basic problem that is giving me some issues. Here is the code in question:
1 2 3 4 5 6 7
double random;
random = pRanGen->Random();
double atom = random;
// Save the old coordinates
double old_coords[3] = { coords[atom][0], coords[atom][1],
coords[atom][2] };
The problem here is my variable type. If I declare atom as an int then my random number generator 'RanGen'(which only accepts doubles) spouts out only 0's due to converting from a double to an int. If I declare atom as a double then the number generator works and I get a range of values for atom, but my coordinate system no longer works. The way I have that 'old_coords' set up it only accepts atom as an int. If atom is a double it tells me that the subscript must have an integral type.
you can use casting like int atom = static_cast<int> random;
hope this will help you but,
i don't know whether this will work for your program or not...