INTERFACE / PUBLIC COMPONENTS / NAMELIST / FILES / REFERENCES / ERRORS / BUGS / PLANS / PRIVATE COMPONENTS

MODULE random_nr_mod

Contact: Jeff Anderson
Reviewers:  
Revision: $Revision: 1.2 $
Release Name: $Name: pre_hawaii $
Change Date: $Date: 2004/12/22 20:48:13 $
Change history: see CVS log

OVERVIEW

A linear congruential random number generator (see Knuth). The values for the parameters are the same as those used in numerical recipes.




OTHER MODULES USED

types_mod
utilities_mod



PUBLIC INTERFACE

use random_nr_mod, only : random_seq_type
 init_ran1
 ran1
 gasdev

NOTES




PUBLIC COMPONENTS




type random_seq_type
   private
   integer             :: ix1, ix2, ix3, iset
   real(r8)            :: r(97), gset
end type random_seq_type

Description

Keeps the state history of the linear congruential number generator. See Knuth for details.


call init_ran1(s,temp)
 type(random_seq_type), intent(out) :: s
 integer, intent(in)                :: temp
 

Description

Initializes a random sequence with an integer. Any sequence initialized with the same integer will produce the same sequence of 'random' numbers.

s    A random sequence to be initialized
temp    An integer seed to start the sequence.


var = ran1(s)
 real(r8)                             :: ran1
 type(random_seq_type), intent(inout) :: s
 

Description

Generate the next uniform [0, 1] random number in the sequence.

ran1    Next uniformly distributed [0, 1] number in sequence.
s    A random sequence.


var = gasdev(s)
 real(r8)                             :: gasdev
 type(random_seq_type), intent(inout) :: s
 

Description

Generates a random draw from a standard gaussian.

gasdev    A random draw from a standard gaussian.
s    A random sequence.




FILES




REFERENCES


ERROR CODES and CONDITIONS

RoutineMessageComment
ran1 Fatal error in random number This should probably be removed; should never happen.



KNOWN BUGS