9 |
|
#include "mpiSimulation.hpp" |
10 |
|
#endif |
11 |
|
|
12 |
+ |
using namespace std; |
13 |
+ |
|
14 |
|
/* randomStreamSPRNF creates a new SPRNG stream for random numbers |
15 |
|
*/ |
16 |
|
|
17 |
|
int randomSPRNG::nStreamsInitialized = 0; |
18 |
|
|
19 |
< |
randomSPRNG::randomSPRNG(iseed){ |
19 |
> |
randomSPRNG::randomSPRNG(int iseed){ |
20 |
|
int newSeed; |
21 |
|
nStreamsInitialized++; |
22 |
|
newSeed = abs(iseed) + nStreamsInitialized; |
33 |
|
#else |
34 |
|
|
35 |
|
nSPRNGStreams = 1; |
36 |
< |
myStreamNumber = nStreamsInitialized; |
36 |
> |
myStreamNumber = 0; |
37 |
|
|
38 |
|
#endif |
39 |
|
|
40 |
+ |
|
41 |
|
thisStream = init_sprng(GTYPE,myStreamNumber,nSPRNGStreams, |
42 |
< |
newSeed,SPRNG_DEFAULT); |
42 |
> |
newSeed,SPRNG_DEFAULT); |
43 |
|
} |
44 |
|
|
45 |
|
randomSPRNG::~randomSPRNG(){ |
46 |
< |
|
47 |
< |
free_sprng(int *thisStream); |
48 |
< |
nStreamsInitialized--; |
49 |
< |
|
46 |
> |
if ( thisStream != NULL){ |
47 |
> |
free_sprng(thisStream); |
48 |
> |
nStreamsInitialized--; |
49 |
> |
} |
50 |
|
} |
51 |
|
|
52 |
|
|