mercredi 26 avril 2017

why random generate number is always the same in fortran90?

I would like to generate a random number in fortran90.

I have a program in fortran90 :

PROGRAM PRINCIPAL

REAL(8)::r
INTEGER::i

DO i=1,5
   CALL RANDOM_NUMBER(r)
   write(*,*) u
END DO

STOP "End program"
END PROGRAM PRINCIPAL

My output are :

user@user-desktop:/media/data/test/ ./simple01.sh
3.920868194323862E-007
2.548044275764261E-002
0.352516161261067
0.666914481524251
0.963055531894656

if I run it again :

user@user-desktop:/media/data/test/ ./simple01.sh
3.920868194323862E-007
2.548044275764261E-002
0.352516161261067
0.666914481524251
0.963055531894656

I don't understand why if I run two time the same script I get the same random numbers ?




Aucun commentaire:

Enregistrer un commentaire