(git:6a2e663)
parallel_rng_types Module Reference

Parallel (pseudo)random number generator (RNG) for multiple streams and substreams of random numbers. More...

Functions/Subroutines

subroutine, public check_rng (output_unit, ionode)
 ... More...
 
type(rng_stream_type) function, public rng_stream_type_from_record (rng_record)
 Create a RNG stream from a record given as an internal file (string). More...
 
real(kind=dp) function, dimension(3, 2), public next_rng_seed (seed)
 Get the seed for the next RNG stream w.r.t. a given seed. More...
 
subroutine, public write_rng_matrices (output_unit)
 Write the transformation matrices of the two MRG components (raised to the specified output) More...
 

Variables

integer, parameter, public rng_record_length = 433
 
integer, parameter, public rng_name_length = 40
 
integer, parameter, public gaussian = 1
 
integer, parameter, public uniform = 2
 

Detailed Description

Parallel (pseudo)random number generator (RNG) for multiple streams and substreams of random numbers.

In detail, this RNG provides 2**64 random number streams each with a length of 2**127 resulting in a length of 2**191 for the total RNG. Moreover, each stream is divided in 2**51 substream of length 2**76. The stream lengths refer to the default precision of 32 bit random number, but also an extended precision of 53 bit per random number can be requested. In this case, two 32 bit random numbers are used to generate a 53 bit random number and therefore the stream length is halved when extended precision are requested.

Usage hint:

type(rng_stream_type) :: rng_stream rng_stream = rng_stream_type(name, ..., error=error)

to generate the first stream. Optionally, you may define a different seed or create a stream of extended precision (53 bits). Then

type(rng_stream_type) :: next_rng_stream next_rng_stream = rng_stream_type(name, last_rng_stream=rng_stream)

to create all the following RNG streams w.r.t. the previous stream. The command line

x = rng_streamnext(error=error)

will provide the next real random number x between 0 and 1 and

ix = rng_streamnext(low, high, error=error)

the next integer random number ix between low and high from stream rng_stream. The default distribution type is a uniform distribution [0,1], but also other distribution types are available (see below).

Literature
P. L'Ecuyer, R. Simard, E. J. Chen, and W. D. Kelton, "An object-oriented random-number package with many long streams and substreams", Operations Research 50(6), 1073-1075 (2002)
Author
C++ code converted to Fortran 90/95 (18.05.2005, Matthias Krack)

Function/Subroutine Documentation

◆ check_rng()

subroutine, public parallel_rng_types::check_rng ( integer, intent(in)  output_unit,
logical, intent(in)  ionode 
)

...

Parameters
output_unit...
ionode...

Definition at line 278 of file parallel_rng_types.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rng_stream_type_from_record()

type(rng_stream_type) function, public parallel_rng_types::rng_stream_type_from_record ( character(len=rng_record_length), intent(in)  rng_record)

Create a RNG stream from a record given as an internal file (string).

Parameters
rng_record...
Returns
...

Definition at line 563 of file parallel_rng_types.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ next_rng_seed()

real(kind=dp) function, dimension(3, 2), public parallel_rng_types::next_rng_seed ( real(kind=dp), dimension(3, 2), intent(in), optional  seed)

Get the seed for the next RNG stream w.r.t. a given seed.

Parameters
seedIf the optional argument seed is missing, then the default seed is returned.
Returns
...

Definition at line 852 of file parallel_rng_types.F.

Here is the caller graph for this function:

◆ write_rng_matrices()

subroutine, public parallel_rng_types::write_rng_matrices ( integer, intent(in)  output_unit)

Write the transformation matrices of the two MRG components (raised to the specified output)

Parameters
output_unit...

Definition at line 1085 of file parallel_rng_types.F.

Here is the caller graph for this function:

Variable Documentation

◆ rng_record_length

integer, parameter, public parallel_rng_types::rng_record_length = 433

Definition at line 65 of file parallel_rng_types.F.

◆ rng_name_length

integer, parameter, public parallel_rng_types::rng_name_length = 40

Definition at line 66 of file parallel_rng_types.F.

◆ gaussian

integer, parameter, public parallel_rng_types::gaussian = 1

Definition at line 73 of file parallel_rng_types.F.

◆ uniform

integer, parameter, public parallel_rng_types::uniform = 2

Definition at line 73 of file parallel_rng_types.F.