Re: Random Numbers
- From: kargl@xxxxxxxxxxxxxxxxxxxxxxxxxxxx (Steven G. Kargl)
- Date: Thu, 29 Jun 2006 19:48:57 +0000 (UTC)
In article <e8194j$jql$1@xxxxxxxxxxxxxxxxx>,
pa@xxxxxxxxxxxxxxxxxxxxx (Pierre Asselin) writes:
Steven G. Kargl <kargl@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
[ wants random numbers reproducible from run to run ]
OTOH, I do use code of the form
call random_seed(size=n)
allocate(put(n))
put = nrand + 37 * (/ (i - 1, i = 1, n) /) ! nrand is user input.
call random_seed(put=put)
deallocate(put)
Does the standard specify what you can or cannot pass to
random_seed(put=) ? I mean the content, not just the size. I was
bitten once by an implementation that was very picky about the
contents of its seed vectors. I did as you show, asking random_seed()
for the size and filling the array with some sequence salted by a
small user input. The resulting sequence was anything but random !
IIRC the standard promises that you can call random_seed(get=) and
use the result in a random_seed(put=), but as far as I know you
can't construct your own seed.
PUT (optional)
shall be a default integer array of rank one and size N. It is an
INTENT (IN) argument. It is used in a processor-dependent manner
to compute the seed value accessed by the pseudorandom number
generator.
You can construct your own seed. It seems that you may have
run into a quality of implementation problem with the compiler
that you used. Were any of PUT(1:N) equal to zero. I recall that
the old UNIX rand() function had a major problem with a seed
of 0.
--
Steve
http://troutmask.apl.washington.edu/~kargl/
.
- References:
- Random Numbers
- From: CTallant
- Re: Random Numbers
- From: dpb
- Re: Random Numbers
- From: Richard E Maine
- Re: Random Numbers
- From: Steven G. Kargl
- Re: Random Numbers
- From: Pierre Asselin
- Random Numbers
- Prev by Date: Re: Random Numbers
- Next by Date: Re: How to Find Memory Used (IVF 9.1, WinXP)
- Previous by thread: Re: Random Numbers
- Next by thread: Re: Random Numbers
- Index(es):
Relevant Pages
|