主题:fortran
program ex0825
implicit none
interface
function random10(a,b)
implicit none
real::a,b
real::random10(10)
end function
end interface
real::a(10)
call RANDOM_SEED
a=random10(1.0,10.0)
write(*,"(10f6.2)")a
end
function random10(a,b)
implicit none
real::a,b
real::len
real::random10(10)
real t
integer i
len=b-a
do i=1,10
call RANDOM_NUMBER(t)
random10(i)=a+len*t
end do
return
end
implicit none
interface
function random10(a,b)
implicit none
real::a,b
real::random10(10)
end function
end interface
real::a(10)
call RANDOM_SEED
a=random10(1.0,10.0)
write(*,"(10f6.2)")a
end
function random10(a,b)
implicit none
real::a,b
real::len
real::random10(10)
real t
integer i
len=b-a
do i=1,10
call RANDOM_NUMBER(t)
random10(i)=a+len*t
end do
return
end