Sujet : Re: Fortran, no RAN ?
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vmsDate : 16. Jun 2024, 19:20:10
Autres entêtes
Organisation : SunSITE.dk - Supporting Open source
Message-ID : <666f2cd9$0$712$14726298@news.sunsite.dk>
References : 1 2
User-Agent : Mozilla Thunderbird
On 6/16/2024 1:54 PM, Arne Vajhøj wrote:
On 6/16/2024 12:22 PM, Michael Brown wrote:
I've been building MTREK, written in fortran, on my community edition and it compiles fine but complains of no RAN function at link time. It's hard to believe they left out this intrinsic function, can anyone clarify this or offer a solution ?
VMS Fortran got both RAN and the standard RANDOM_NUMBER:
program randemo
implicit none
integer*4 seed, i
real*4 r1,r2
seed = 1234567
do 100 i = 1,5
r1 = ran(seed)
write(*,*) r1
call random_number(r2)
write(*,*) r2
100 continue
end
With RTL as 3rd option:
program randemo
implicit none
integer*4 seed, i
real*4 r1,r2,r3
integer*4 pas$clock2
real*4 math$random_l_s
seed = pas$clock2() ! hack
do 100 i = 1,5
r1 = ran(seed)
call random_number(r2)
r3 = math$random_l_s(seed) ! mth$random return F float
write(*,*) r1,r2,r3
100 continue
end
Arne