Next / Previous / Index / TCC Help System / Publications / Site map / NM Tech homepage

Repeatable pseudorandom sequences in Fortran

Tech Computer Center logo

Every time you call the Fortran function rand(0), it returns a number between 0.0 and 1.0. Statistically, these numbers are uniformly distributed, which means that it is equally likely that the numbers will be anywhere in this range.

If every call to rand() supplies an argument of 0, your program will get exactly the same sequence of random numbers every time. For example, here is a short program:

      integer i
      real rand
      do i = 1, 4
        print *, rand(0)
      end do
      stop
      end
Every time it runs, it produces the same output:
    0.968071
     6.67306E-02
    0.478281
    0.909534

Next: Non-repeating pseudorandom sequences in Fortran
See also: Generating random numbers in Fortran
Previous: What is a pseudorandom number sequence?
Site map
Index: Keyword index to help pages
Help: New Mexico Tech Computer Center: Help System
TCC Publications
Home: About New Mexico Tech

John Shipman, john@nmt.edu

Last updated: 1995/12/19 18:58:09 UT
URL: http://www.nmt.edu/tcc/help/lang/fortran/noseed.html