This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] PATCH -- Fix segfault in RANDOM_SEED.


Steve Kargl wrote:

So far so go. XOR'ing will statisfy the above requirement. However, this is where the fun begins.

   When the values differ, the use of either value as the PUT
   argument in a subsequent call to RANDOM SEED shall result in the
   same sequence of pseudo-random numbers being generated.  For example,
   after execution of the statements

     CALL  RANDOM_SEED (PUT=SEED1)
     CALL  RANDOM_SEED (GET=SEED2)
     CALL  RANDOM_NUMBER (X1)
     CALL  RANDOM_SEED (PUT=SEED2)
     CALL  RANDOM_NUMBER (X2)

X2 equals X1.

Just XOR the seed before filling in seed2 (in RANDOM_SEED) should do the trick, I believe.

- Tobi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]