program aleatorio
real :: x(10),m(3,3),s(3)=(/0,0,0/)
print '(a,$)', "introduce a,b: "
read *, a, b
rango = b - a
! call init_random_seed_clock()    ! non-reproducible
call init_random_seed_default()  ! reproducible
call random_number(x)
print '("real: ",10f8.4)', rango*x + a
call random_number(x)
print '("enteiro: ",10i5)', int(rango*x + a)
call random_number(m)
m=int(rango*m+a)
print *,'matriz de enteiros:'
do i=1,3
	print *,(int(m(i,j)),j=1,3)
end do
stop
end program aleatorio
!------------------------------------
subroutine init_random_seed_clock()
integer :: i, n, clock
integer, allocatable :: seed(:)
call random_seed(size = n)
allocate(seed(n))
call system_clock(count = clock)
seed = clock + 37 * (/ (i - 1, i = 1, n) /)
call random_seed(put = seed)
deallocate(seed)
return
end subroutine
!------------------------------------
subroutine init_random_seed_default()
integer :: i, n
integer,allocatable :: seed(:)
call random_seed(size=n)
allocate(seed(n))
seed=0
call random_seed(put=seed)
deallocate(seed)
return
end subroutine
