Generating random number in a given range in Fortran 77

S Ali picture S Ali · May 22, 2009 · Viewed 11.7k times · Source

I am a beginner trying to do some engineering experiments using fortran 77. I am using Force 2.0 compiler and editor. I have the following queries:

  1. How can I generate a random number between a specified range, e.g. if I need to generate a single random number between 3.0 and 10.0, how can I do that?
  2. How can I use the data from a text file to be called in calculations in my program. e.g I have temperature, pressure and humidity values (hourly values for a day, so total 24 values in each text file).
  3. Do I also need to define in the program how many values are there in the text file?

Answer

las3rjock picture las3rjock · May 22, 2009

Knuth has released into the public domain sources in both C and FORTRAN for the pseudo-random number generator described in section 3.6 of The Art of Computer Programming.