big commit before big mess

This commit is contained in:
tth
2022-10-28 21:53:57 +02:00
parent 7cde5e3b6b
commit 23f3eeb032
17 changed files with 225 additions and 28 deletions

View File

@@ -1,14 +1,22 @@
#
# Fortraneries by tTh -
# Fortraneries by tTh - Random Stuff
#
GFOPT = -Wall -Wextra -g -time
all: essai displaykinds
# -----------------------------------------------------
essai: essai.f90 Makefile
gfortran -Wall $< -o $@
mathstuff2.o: mathstuff2.f90 Makefile
gfortran $(GFOPT) -c $<
# -----------------------------------------------------
essai: essai.f90 Makefile mathstuff2.o
gfortran $(GFOPT) $< mathstuff2.o -o $@
displaykinds: displaykinds.f90 Makefile
gfortran -Wall $< -o $@
gfortran $(GFOPT) $< -o $@
# -----------------------------------------------------

View File

@@ -1,5 +1,5 @@
program displaykinds
print *, "display all kind's variants"
print *, "--- display all kind's variants ---"
end program

View File

@@ -1,5 +1,21 @@
program essai
print *, "essai"
use mathstuff2
implicit none
integer :: foo, bar
real :: quux
double precision :: somme
write(0, *) "----------------- essai -------------------"
call init_random_seed() ! in module 'mathstuff'
somme = 0.0
do foo=1, 500
quux = rand() + rand()
somme = somme + quux
bar = mod(irand(), 7)
print *, foo, quux, somme/foo, bar
enddo
end program

View File

@@ -0,0 +1,33 @@
module mathstuff2
! XXX This module was a copy of mathstuff.f90 fromthe BloubWorld
! XXX wil be moved in an other place some day...
implicit none
contains
! ----------------------------------------------------------------
! really quick'n'dirty hack
! not really tested yet...
subroutine init_random_seed()
integer, dimension(3) :: tarray
integer :: t3, foo
real :: dummy
call itime(tarray)
t3 = 3600*tarray(1) + 60*tarray(2) + tarray(3)
! write(0, '(A,3I3,A,I6)') "sranding: ", tarray, " --> ", t3
call srand(t3)
! after initializing the random generator engine,
! you MUST use it for initializing the initializer
do foo=1, tarray(1)+5
dummy = rand()
enddo
end subroutine
! ----------------------------------------------------------------
end module mathstuff2