function rand_range( min, max ) result( x ) real, intent( in ) :: min, max real :: x integer :: sz integer, allocatable :: seed(:)
call random_seed( size = sz ) allocate( seed( sz ) ) call random_seed( get = seed ) x = modulo( rand(), max - min ) + min
end
program hello print *, rand_range( 0.0, 1.0 ) end program hello
function rand_range( min, max ) result( x ) real, intent( in ) :: min, max real :: x integer :: sz integer, allocatable :: seed(:)
end
program hello print *, rand_range( 0.0, 1.0 ) end program hello
by Lanitta Johnson, 6 months agoPlease log in to post a comment.