RANDOMU (version 5) is not always uniform [message #10430] |
Fri, 05 December 1997 00:00 |
Patrick Broos
Messages: 27 Registered: December 1996
|
Junior Member |
|
|
Dear Colleague,
A potentially serious bug in version 5 of IDL has come to my attention
and
has been confirmed by RSI. Under conditions which I consider to be
commonly
encountered, the RANDOMU routine produces values whose distribution
differs
significantly from uniform. Although I have not tested the gaussian,
binomial, poisson, etc. generators, I would assume that they are
corrupted
as well.
The problem appears to occur when calls to RANDOMU involving two
different seed variables are interleaved. The demo program below
illustrates a common situation where this might occur. A user program
("demo") explicitly uses one seed variable ("seed") for all its RANDOM?
calls. However, it also calls some library routine written by someone
else ("lib_random") which happens to make RANDOM? calls of its own,
using a second seed variable. If you execute "demo, /BREAK_IT" you
will see a significant excess in the distribution of the random numbers
between 0 and 0.03. I'm sure some people will run into this problem
even though they do not use library routines (as in this example),
simply because they failed to ensure that they use only one seed
variable everywhere in their own code.
------------------------------------------------------------ -----------------
FUNCTION lib_random
return, randomu(other_seed,1)
end
PRO demo, x, BREAK_IT=break_it
x = fltarr(100000)
for ii = 0L, n_elements(x)-1 do begin
x(ii) = randomu(seed,1)
if keyword_set(break_it) then dummy = lib_random()
endfor
h = histogram( x, MIN=0.0, BIN=0.01 )
plot, h, PSYM=10
print, h
return
end
------------------------------------------------------------ -----------------
RSI has been notified. They have been responsive to my queries and
have confirmed that this bug is not in version 4.0.1. They have
predicted that this will be fixed in revision 5.1 which is due out "in
the early part (1st quarter'ish) of 1998". I strongly suggested that
it would be better if RSI made this announcement, rather than me, but
they did not seem interested in doing that at this time. I offered to
include in this message any remarks RSI would care to make, but they
declined. In our own astronomy research, we have found that this
problem significantly corrupts the scientific results we are
producing. I felt that the user community needs to be aware of this
potential problem as soon as possible.
Regards,
Patrick Broos
============================================================ ========
Patrick S. Broos, Systems Analyst/Programmer patb@astro.psu.edu
Department of Astronomy and Astrophysics My office 814-863-5505
Penn State University
525 Davey Lab FAX 814-863-8686
University Park, PA 16802-6305
http://www.astro.psu.edu Group office 863-9550
|
|
|