This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran] PATCH -- Fix segfault in RANDOM_SEED.
- From: Paul Brook <paul at codesourcery dot com>
- To: fortran at gcc dot gnu dot org, kargls at comcast dot net
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 23 May 2004 18:49:58 +0100
- Subject: Re: [gfortran] PATCH -- Fix segfault in RANDOM_SEED.
- Organization: CodeSourcery
- References: <20040523090508.17ede8c7.kargls@comcast.net>
On Sunday 23 May 2004 17:05, Steven G. Kargl wrote:
> This patch fixes a segfault when using the PUT
> argument of RANDOM_SEED. There, however, is a
> major problem with the current PRNG. This
> simple program appears to trigger an alarmingly
> bad sequence of numbers.
It looks like this could be a known problem with the generator. A poor (not
very random) seed will give poor generated numbers.
Also, the first 600 numbers returned will be the seed values (cast to unsigned
int, then converted back to a float).
The way we convert from int to float (discard least significant bits) may
exaggerate the problem in this case.
I also noticed that random_seed(get) changes the sequence of random numbers.
This is now PR15619.
> 2004-05-23 Steven G. Kargl <kargls@comcast.net>
> * random.c (random_seed): Use correct variable.
Applied, thanks.
Paul