how to generate random number in Fortran ?
Any one has experience to generate a random number in Fortran? using
random_number(a), ... What's the details? Thanks tang |
Re: how to generate random number in Fortran ?
Check Numerical Recipes in FORTRAN online......
|
Re: how to generate random number in Fortran ?
for fortran 90, use: CALL RANDOM_NUMBER(random), then the variable random can be used!
|
Re: how to generate random number in Fortran ?
but use
CALL RANDOM_NUMBER gives a same number at different runs. That is, it is not random if different runs are made. Using 'seed' may solve the problem? then how? |
Re: how to generate random number in Fortran ?
I am not sure but all random number generators produce the same number if you use the same number for their initialization. If you want to get a number which is more random (for you) initialize the generator with e.g. actual time on your computer.
hope it helps vladimir |
Re: how to generate random number in Fortran ?
But how to set actual time as the seed? What's the command in Fortran?
Thanks T |
Re: how to generate random number in Fortran ?
These links might be helpful:
http://rsc.anu.edu.au/~harry/COURSES...TH/node73.html http://www.fortran.com/fortran/random1.f90 http://www.fortran.com/fortran/random2.f90 http://www.fortran.com/fortran/kiss.f90 http://www.library.cornell.edu/nr/nr_index.cgi The system random generator is sometimes not as random as you would like it to be. The routines in Numerical Recepies are pretty good. Regards. |
thanks to your all three
Dear Nashat, etc
Thanks a lot T |
All times are GMT -4. The time now is 23:32. |