Changeset 3889 in Sophya
- Timestamp:
- Sep 27, 2010, 11:24:10 PM (15 years ago)
- Location:
- trunk/SophyaLib/BaseTools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/randr48.cc
r3838 r3889 45 45 } 46 46 47 /*! 48 \brief Initialize the state of the random generator object using the integer value argument 49 50 \warning This method changes the global random generator drand48() state 51 */ 47 52 void DR48RandGen::SetSeed(long int seed) 48 53 { … … 50 55 } 51 56 57 /*! 58 \brief Initialize the state of the random generator object using the short integer array 59 60 \warning This method changes the global random generator drand48() state 61 */ 52 62 void DR48RandGen::SetSeed(uint_2 seed[3]) 53 63 { 54 64 seed48(seed); 55 65 } 66 67 //! Return the random generator state 56 68 void DR48RandGen::GetSeed(uint_2 seed[3]) 57 69 { … … 68 80 } 69 81 82 /*! 83 \brief Random Initialization of the state of the random generator object using the system clock 84 85 \warning This method changes the global random generator drand48() state 86 */ 70 87 void DR48RandGen::AutoInit(int lp) 71 88 { … … 185 202 } 186 203 204 /*! 205 \brief Initialize the state of the random generator object using the integer value argument 206 207 \warning This method changes the global random generator drand48() state 208 */ 187 209 void ThSDR48RandGen::SetSeed(long int seed) 188 210 { … … 190 212 ths_rand->lock(); 191 213 DR48RandGen::SetSeed(seed); 214 if(!fg_nothrsafe) idx_ = rseq_.Size(); 192 215 ths_rand->unlock(); 193 216 return; 194 217 } 195 218 219 /*! 220 \brief Initialize the state of the random generator object using the short integer array 221 222 \warning This method changes the global random generator drand48() state 223 */ 196 224 void ThSDR48RandGen::SetSeed(uint_2 seed[3]) 197 225 { 198 226 if (ths_rand == NULL) ths_rand = new ThSafeOp; 199 227 ths_rand->lock(); 200 SetSeed_P(seed); 228 DR48RandGen::SetSeed(seed); 229 if(!fg_nothrsafe) idx_ = rseq_.Size(); 201 230 ths_rand->unlock(); 202 231 } 203 232 233 //! Return the random generator state 204 234 void ThSDR48RandGen::GetSeed(uint_2 seed[3]) 205 235 { 206 236 if (ths_rand == NULL) ths_rand = new ThSafeOp; 207 237 ths_rand->lock(); 208 GetSeed_P(seed);238 DR48RandGen::GetSeed(seed); 209 239 ths_rand->unlock(); 210 240 return; 211 241 } 212 242 213 void ThSDR48RandGen::SetSeed_P(uint_2 seed[3]) 214 { 215 DR48RandGen::SetSeed(seed); 216 } 217 218 void ThSDR48RandGen::GetSeed_P(uint_2 seed[3]) 219 { 220 DR48RandGen::GetSeed(seed); 221 } 222 243 244 /*! 245 \brief Random Initialization of the state of the random generator object using the system clock 246 247 \warning This method changes the global random generator drand48() state 248 */ 223 249 void ThSDR48RandGen::AutoInit(int lp) 224 250 { … … 245 271 return(rseq_(idx_++)); 246 272 } 273 } 274 275 void ThSDR48RandGen::GetSeed_P(uint_2 seed[3]) 276 { 277 return DR48RandGen::GetSeed(seed); 247 278 } 248 279 -
trunk/SophyaLib/BaseTools/randr48.h
r3838 r3889 70 70 virtual r_8 Next(); 71 71 72 // Non thread-safe version of Init() and GetSeed() 73 void SetSeed_P(uint_2 seed[3]); 74 void GetSeed_P(uint_2 seed[3]); 72 virtual void GetSeed_P(uint_2 seed[3]); // Pour utilisation par PPF handler 75 73 76 74 }; -
trunk/SophyaLib/BaseTools/stsrand.cc
r3619 r3889 14 14 \brief Random number generator 15 15 16 \warning This class is OBSOLETE. Use ThSDR48RandGen instead. 16 17 This class is a thread-safe random number generator. 17 18 Its PPF handler can be used to save the complete state of the class and the underlying … … 32 33 STSRandGen::STSRandGen(size_t n, bool tsafe) 33 34 { 35 cout << " STSRandGen::STSRandGen()/Warning : this class is OBSOLETE. Use ThSDR48RandGen !" << endl; 36 cout << " STSRandGen::STSRandGen()/Warning : this class is OBSOLETE. Use ThSDR48RandGen !" << endl; 37 34 38 if (ths_rand == NULL) ths_rand = new ThSafeOp; 35 39 if (tsafe) { // thread-safe
Note:
See TracChangeset
for help on using the changeset viewer.