As an existing package I suspect that it already calls the R RNG, but the default RNG changed [1] so you need to call RNGkind(sample.kind = "Rounding") before calling set.seed in your test code to compare with old results.

[1] https://stackoverflow.com/questions/47199415/is-set-seed-consistent-over-different-versions-of-r-and-ubuntu/56381613#56381613 On January 17, 2020 6:39:14 AM PST, Ivan Krylov <krylov.r...@gmail.com> wrote: >On Fri, 17 Jan 2020 13:55:39 +0000 >وليد خلف معوض المطيرى <wkmtie...@qu.edu.sa> wrote: > >> So, does anyone have an idea of how to solve this issue. > >"Writing R Extensions", 1.6. Writing portable packages: > >>> Compiled code should not call the system random number generators >>> such as rand, drand48 and random, but rather use the interfaces to >>> R’s RNGs described in Random numbers. In particular, if more than >>> one package initializes the system RNG (e.g. via srand), they will >>> interfere with each other. > >>> Nor should the C++11 random number library be used, nor any other >>> third-party random number generators such as those in GSL. > >It somewhat less convenient to call the R random number generator from >Fortran than it would be from C or C++, but still possible. There is a >F77-style example of such use [1], but since you are already using >iso_c_binding, you should be able to declare the C API [2] right in the >Fortran source: > >subroutine GetRNGState() bind(c) >end subroutine > >subroutine PutRNGstate() bind(c) >end subroutine > >As a bonus, you get to use the R distribution functions [3], without >the need to implement them yourself from uniformly distributed samples: > >function rnorm(mu, sigma) bind(c) result(ret) > use intrinsic, iso_c_binding, only: c_double > real(c_double), value :: mu, sigma > real(c_double) ret >end function > >function rgamma(shape, scale) bind(c) result(ret) > use intrinsic, iso_c_binding, only: c_double > real(c_double), value :: shape, scale > real(c_double) ret >end function > >(The prototypes above are unchecked; I haven't written any Fortran 2003 >in more than a year.) -- Sent from my phone. Please excuse my brevity. ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel