Re: Random Numbers



On 6/29/2006 12:19 PM, Pierre Asselin wrote:
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 !

My reading of the vendor docs for my compiler (presumably echoing
the standard), is that the input to random_seed with the "put" option
is a rank-1 array of default integer (as is the output with the "get"
option). Long experience with various PRNGs would suggest *large* *odd*
values are best as seeds. Small integers are very poor choices. I am
not the least bit surprised by your result if that was your choice...

-Ken
--
I don't speak for Intel, Intel doesn't speak for me...

Ken Fairfield
D1C Automation VMS System Support
who: kenneth dot h dot fairfield
where: intel dot com
.



Relevant Pages