# how to generate random number in Fortran ?

 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 1, 2003, 10:14 how to generate random number in Fortran ? #1 tang 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, 13:47 Re: how to generate random number in Fortran ? #2 R. Andom. Guest   Posts: n/a Check Numerical Recipes in FORTRAN online......

 April 2, 2003, 09:48 Re: how to generate random number in Fortran ? #3 littlelz Guest   Posts: n/a for fortran 90, use: CALL RANDOM_NUMBER(random), then the variable random can be used!

 April 2, 2003, 09:54 Re: how to generate random number in Fortran ? #4 tang 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, 11:12 Re: how to generate random number in Fortran ? #5 Vladimir Krejci 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, 11:23 Re: how to generate random number in Fortran ? #6 tang Guest   Posts: n/a But how to set actual time as the seed? What's the command in Fortran? Thanks T

 April 2, 2003, 17:48 Re: how to generate random number in Fortran ? #7 Nashat 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, 17:58 thanks to your all three #8 tang Guest   Posts: n/a Dear Nashat, etc Thanks a lot T

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post rick Main CFD Forum 45 September 6, 2011 00:52 bookie56 OpenFOAM Installation 8 August 13, 2011 04:03 maka OpenFOAM Pre-Processing 6 August 12, 2010 09:01 chelvistero OpenFOAM 11 January 15, 2010 20:43 hjasak OpenFOAM Native Meshers: blockMesh 11 August 15, 2008 07:36

All times are GMT -4. The time now is 22:29.