Changeset 3889 in Sophya


Ignore:
Timestamp:
Sep 27, 2010, 11:24:10 PM (15 years ago)
Author:
ansari
Message:

correction bug SetSeed() ds ThSDR48RandGen + retag en V2_2, Reza 27/09/2010

Location:
trunk/SophyaLib/BaseTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/BaseTools/randr48.cc

    r3838 r3889  
    4545}
    4646
     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*/
    4752void DR48RandGen::SetSeed(long int  seed)
    4853{
     
    5055}
    5156
     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*/
    5262void DR48RandGen::SetSeed(uint_2 seed[3])
    5363{
    5464  seed48(seed);
    5565}
     66
     67//! Return the random generator state
    5668void DR48RandGen::GetSeed(uint_2 seed[3])
    5769{
     
    6880}
    6981
     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*/
    7087void DR48RandGen::AutoInit(int lp)
    7188{
     
    185202}
    186203
     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*/
    187209void ThSDR48RandGen::SetSeed(long int seed)
    188210{
     
    190212  ths_rand->lock();
    191213  DR48RandGen::SetSeed(seed);
     214  if(!fg_nothrsafe) idx_ = rseq_.Size();
    192215  ths_rand->unlock();
    193216  return;
    194217}
    195218
     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*/
    196224void ThSDR48RandGen::SetSeed(uint_2 seed[3])
    197225{
    198226  if (ths_rand == NULL)  ths_rand = new ThSafeOp;
    199227  ths_rand->lock();
    200   SetSeed_P(seed);
     228  DR48RandGen::SetSeed(seed);
     229  if(!fg_nothrsafe) idx_ = rseq_.Size();
    201230  ths_rand->unlock();
    202231}
    203232
     233//! Return the random generator state
    204234void ThSDR48RandGen::GetSeed(uint_2 seed[3])
    205235{
    206236  if (ths_rand == NULL)  ths_rand = new ThSafeOp;
    207237  ths_rand->lock();
    208   GetSeed_P(seed);
     238  DR48RandGen::GetSeed(seed);
    209239  ths_rand->unlock();
    210240  return;
    211241}
    212242
    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*/
    223249void ThSDR48RandGen::AutoInit(int lp)
    224250{
     
    245271    return(rseq_(idx_++));
    246272  }
     273}
     274
     275void ThSDR48RandGen::GetSeed_P(uint_2 seed[3])
     276{
     277  return DR48RandGen::GetSeed(seed);
    247278}
    248279
  • trunk/SophyaLib/BaseTools/randr48.h

    r3838 r3889  
    7070  virtual r_8 Next();
    7171
    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
    7573
    7674};
  • trunk/SophyaLib/BaseTools/stsrand.cc

    r3619 r3889  
    1414   \brief Random number generator
    1515
     16   \warning This class is OBSOLETE. Use ThSDR48RandGen instead.
    1617   This class is a thread-safe random number generator.
    1718   Its PPF handler can be used to save the complete state of the class and the underlying
     
    3233STSRandGen::STSRandGen(size_t n, bool tsafe)
    3334{
     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
    3438  if (ths_rand == NULL)  ths_rand = new ThSafeOp;
    3539  if (tsafe) {   // thread-safe
Note: See TracChangeset for help on using the changeset viewer.