1 |
< |
/* |
1 |
> |
/* |
2 |
|
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
|
* |
4 |
|
* The University of Notre Dame grants you ("Licensee") a |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
< |
int SeqRandNumGen::nCreatedRNG_ = 0; |
49 |
> |
int SeqRandNumGen::nCreatedRNG_ = 0; |
50 |
|
|
51 |
< |
SeqRandNumGen::SeqRandNumGen( const uint32& oneSeed) { |
51 |
> |
SeqRandNumGen::SeqRandNumGen( const uint32& oneSeed) { |
52 |
|
|
53 |
|
//In order to generate independent random number stream, the actual seed used by random |
54 |
|
//number generator is the seed passed to the constructor plus the number of random number |
56 |
|
int newSeed = oneSeed + nCreatedRNG_; |
57 |
|
mtRand_ = new MTRand(newSeed, 1, 0); |
58 |
|
++nCreatedRNG_; |
59 |
< |
} |
59 |
> |
} |
60 |
|
|
61 |
< |
SeqRandNumGen::SeqRandNumGen() { |
61 |
> |
SeqRandNumGen::SeqRandNumGen() { |
62 |
|
|
63 |
|
//the default seeds generated by MTRand will make sure they are unique |
64 |
|
mtRand_ = new MTRand(1, 0); |
65 |
|
++nCreatedRNG_; |
66 |
< |
} |
66 |
> |
} |
67 |
|
|
68 |
|
|
69 |
< |
void SeqRandNumGen::seed( const uint32 oneSeed ) { |
69 |
> |
void SeqRandNumGen::seed( const uint32 oneSeed ) { |
70 |
|
|
71 |
|
int newSeed = oneSeed + nCreatedRNG_; |
72 |
|
mtRand_->seed(newSeed); |
73 |
|
|
74 |
|
++nCreatedRNG_; |
75 |
< |
} |
75 |
> |
} |
76 |
|
|
77 |
< |
void SeqRandNumGen::seed() { |
77 |
> |
void SeqRandNumGen::seed() { |
78 |
|
|
79 |
|
mtRand_->seed(); |
80 |
|
++nCreatedRNG_; |
81 |
< |
} |
81 |
> |
} |
82 |
|
|
83 |
|
|
84 |
|
} |