Fortraneries/BloubWorld/essai.f90

34 lines
709 B
Fortran
Raw Normal View History

2022-02-17 10:51:56 +01:00
program essai
2024-01-31 11:11:50 +01:00
! use bloubspace
2022-02-17 10:51:56 +01:00
use mathstuff
implicit none
2022-03-18 12:21:40 +01:00
2024-01-31 11:11:50 +01:00
call test_random(10)
2022-03-18 12:21:40 +01:00
STOP ': BECAUSE JOB IS DONE'
! --------------------------------------------------------------
contains
subroutine test_random(nbre)
integer, intent(in) :: nbre
2024-01-31 11:11:50 +01:00
integer :: foo
real :: quux, bar
2022-02-17 14:10:15 +01:00
double precision :: somme
2022-02-17 10:51:56 +01:00
2022-03-18 12:21:40 +01:00
call init_random_seed() ! in module 'mathstuff'
2022-02-17 14:10:15 +01:00
somme = 0.0
2022-03-18 12:21:40 +01:00
do foo=1, nbre
2024-01-31 11:11:50 +01:00
quux = 10.0 * rand()
2022-02-17 14:10:15 +01:00
somme = somme + quux
2024-01-31 11:11:50 +01:00
bar = quux ** (.1/.3)
print *, quux, bar, somme/foo
2022-02-17 10:51:56 +01:00
enddo
2022-03-18 12:21:40 +01:00
end subroutine test_random
! --------------------------------------------------------------
2022-02-17 10:51:56 +01:00
2022-03-18 12:21:40 +01:00
end program