[R] Call subroutine init_random_seed () in R

Kodalore Vijayan, Vineetha W vwkv13 at mun.ca
Tue Jun 28 00:40:53 CEST 2016


I want to call the subroutine init_random_seed() in R. The subroutine is
defined as an example in the following link.

https://gcc.gnu.org/onlinedocs/gfortran/RANDOM_005fSEED.html

subroutine init_random_seed()
        use iso_fortran_env, only: int64
        implicit none
        integer, allocatable :: seed(:)
        integer :: i, n, un, istat, dt(8), pid
        integer(int64) :: t

        call random_seed(size = n)
        allocate(seed(n))
        ! First try if the OS provides a random number generator
        open(newunit=un, file="/dev/urandom", access="stream", &
             form="unformatted", action="read", status="old", iostat=istat)
        if (istat == 0) then
           read(un) seed
           close(un)
        .............
        .......

    end subroutine init_random_seed

I do not know what variable goes in when you write the function
.fortran () in R. Any guidance is appreciated.

	[[alternative HTML version deleted]]



More information about the R-help mailing list