This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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.


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


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