--- trunk/mdtools/md_code/randomSPRNG.cpp 2003/01/03 22:04:50 223 +++ trunk/mdtools/md_code/randomSPRNG.cpp 2003/01/30 15:20:21 253 @@ -9,12 +9,14 @@ #include "mpiSimulation.hpp" #endif +using namespace std; + /* randomStreamSPRNF creates a new SPRNG stream for random numbers */ int randomSPRNG::nStreamsInitialized = 0; -randomSPRNG::randomSPRNG(iseed){ +randomSPRNG::randomSPRNG(int iseed){ int newSeed; nStreamsInitialized++; newSeed = abs(iseed) + nStreamsInitialized; @@ -31,19 +33,20 @@ randomSPRNG::randomSPRNG(iseed){ #else nSPRNGStreams = 1; - myStreamNumber = nStreamsInitialized; + myStreamNumber = 0; #endif + thisStream = init_sprng(GTYPE,myStreamNumber,nSPRNGStreams, - newSeed,SPRNG_DEFAULT); + newSeed,SPRNG_DEFAULT); } randomSPRNG::~randomSPRNG(){ - - free_sprng(int *thisStream); - nStreamsInitialized--; - + if ( thisStream != NULL){ + free_sprng(thisStream); + nStreamsInitialized--; + } }