On Fri, Jan 17, 2020 at 2:56 PM ‫وليد خلف معوض المطيرى‬‎
<wkmtie...@qu.edu.sa> wrote:‬
> This might be because the RNG method used in random_number function is 
> different between the used version GCC 6 or less and the new ones GCC 8 or 
> greater.

This is quite likely correct. The current gfortran docs [1] list
xoshiro256** as the RNG used for RANDOM_NUMBER. This is a relatively
recent RNG [2], so older versions of gfortran must have used something
else, leading to different results even for identical seed values.
This explains the WRE excerpt quoted by Ivan: If you want reproducible
results, you must not use an external RNG which might change without
warning. The obvious solution would be to use R's RNG as suggested
before. If that is to slow for your application, you can use faster
RNGs that are provided by some packages. For example, my dqrng package
[3] includes xoshiro256+, though I have not tried to use this from
Fortran code.


[1] https://gcc.gnu.org/onlinedocs/gfortran/RANDOM_005fNUMBER.html
[2] https://arxiv.org/abs/1805.01407
[3] https://www.daqana.org/dqrng/

R-package-devel@r-project.org mailing list

Reply via email to