[gfortran] PATCH -- Fix segfault in RANDOM_SEED.

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Wed May 26 19:39:00 GMT 2004


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



More information about the Fortran mailing list