Re: [R] Fortran dy lib on Solaris

From: Jin Shusong <jinss_at_hkusua.hku.hk>
Date: Fri 29 Apr 2005 - 11:52:24 EST

On Thu, Apr 28, 2005 at 05:11:11PM +0100, V Nyirongo wrote:
> Dear all,
>
> Am new on this list but need help:
>
> I have a fortran code which I compile into a dynamic library (on Solaris).
>
> My probem is that when I call this code soon after starting R, it runs ok.
> But it doesn't for the second time without exiting R first. In this code I
> have to generate some random numbers. The problem is not about setting the
> seed.
>
> Anyone with an idea what might be going on?
>
> Thanks,
> Vysaul.
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
Dear Vysaul,

  You can call srand to set the seed.

       implicit none
       integer i,seed,time
       seed=time()*2-13
       call srand(seed)
       print*,rand(0)
       do 10 i= 1, 10
         print*, rand(0)
10     continue
       end
 

  At least g77 can support srand and rand

  Good luck.

-- 


                       Yours  Sincerely

                               Shusong Jin


===============================================================
Add: Meng Wah Complex, RM518     Email: jinss@hkusua.hku.hk
     Dept. of Statistics         Tel:   (+852)28597942
      and Actuarial Science      fax:   (+852)28589041
     The Univ. of Hong Kong
     Pokfulam Road, Hong Kong

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Fri Apr 29 12:03:09 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:30 EST