|
[Sponsors] |
April 1, 2003, 11:14 |
how to generate random number in Fortran ?
|
#1 |
Guest
Posts: n/a
|
Any one has experience to generate a random number in Fortran? using
random_number(a), ... What's the details? Thanks tang |
|
April 1, 2003, 14:47 |
Re: how to generate random number in Fortran ?
|
#2 |
Guest
Posts: n/a
|
Check Numerical Recipes in FORTRAN online......
|
|
April 2, 2003, 10:48 |
Re: how to generate random number in Fortran ?
|
#3 |
Guest
Posts: n/a
|
for fortran 90, use: CALL RANDOM_NUMBER(random), then the variable random can be used!
|
|
April 2, 2003, 10:54 |
Re: how to generate random number in Fortran ?
|
#4 |
Guest
Posts: n/a
|
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? |
|
April 2, 2003, 12:12 |
Re: how to generate random number in Fortran ?
|
#5 |
Guest
Posts: n/a
|
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 |
|
April 2, 2003, 12:23 |
Re: how to generate random number in Fortran ?
|
#6 |
Guest
Posts: n/a
|
But how to set actual time as the seed? What's the command in Fortran?
Thanks T |
|
April 2, 2003, 18:48 |
Re: how to generate random number in Fortran ?
|
#7 |
Guest
Posts: n/a
|
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. |
|
April 2, 2003, 18:58 |
thanks to your all three
|
#8 |
Guest
Posts: n/a
|
Dear Nashat, etc
Thanks a lot T |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Comparison between C/C++ and Fortran? | rick | Main CFD Forum | 45 | September 6, 2011 01:52 |
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 | bookie56 | OpenFOAM Installation | 8 | August 13, 2011 05:03 |
DecomposePar unequal number of shared faces | maka | OpenFOAM Pre-Processing | 6 | August 12, 2010 10:01 |
[snappyHexMesh] external flow with snappyHexMesh | chelvistero | OpenFOAM Meshing & Mesh Conversion | 11 | January 15, 2010 20:43 |
[blockMesh] BlockMeshmergePatchPairs | hjasak | OpenFOAM Meshing & Mesh Conversion | 11 | August 15, 2008 08:36 |