FMS  2024.03
Flexible Modeling System
random_numbers_mod

Generic module to wrap random number generators. More...

Data Types

interface  getrandomnumbers
 Returns scalar, 1 or 2 D random real numbers. More...
 
interface  initializerandomnumberstream
 Initializes stream for generating random numbers. More...
 
type  randomnumberstream
 Type to hold a stream of randomly generated numbers. More...
 

Functions/Subroutines

integer function, dimension(8), public constructseed (i, j, time, perm)
 Constructs a unique seed from grid cell index and model date/time The perm is supplied we generate a different seed by circularly shifting the bits of the seed - this is useful if we want to create more than one seed for a given column and model date/time. Note that abs(perm) must be <= the number of bits used to represent the default integer (likely 32)
 
type(randomnumberstream) function initializerandomnumberstream_s (seed)
 Initialization.
 
type(randomnumberstream) function initializerandomnumberstream_v (seed)
 

Detailed Description

Generic module to wrap random number generators.

The module defines a type that identifies the particular stream of random numbers, and has procedures for initializing it and getting real numbers in the range 0 to 1. This version uses the Mersenne Twister to generate random numbers on [0, 1].


Data Type Documentation

◆ random_numbers_mod::getrandomnumbers

interface random_numbers_mod::getrandomnumbers

Returns scalar, 1 or 2 D random real numbers.

Parameters
streamrandomNumberStream to generate from
[out]numberoutput number(s)

Definition at line 50 of file random_numbers.F90.

Private Member Functions

 get_random_number_0d_r4
 
 get_random_number_0d_r8
 
 get_random_number_1d_r4
 
 get_random_number_1d_r8
 
 get_random_number_2d_r4
 
 get_random_number_2d_r8
 

◆ random_numbers_mod::initializerandomnumberstream

interface random_numbers_mod::initializerandomnumberstream

Initializes stream for generating random numbers.

Definition at line 58 of file random_numbers.F90.

Private Member Functions

type(randomnumberstream) function initializerandomnumberstream_s (seed)
 Initialization.
 
type(randomnumberstream) function initializerandomnumberstream_v (seed)
 

◆ random_numbers_mod::randomnumberstream

type random_numbers_mod::randomnumberstream

Type to hold a stream of randomly generated numbers.

Definition at line 41 of file random_numbers.F90.

Collaboration diagram for randomnumberstream:
[legend]

Private Attributes

type(randomnumbersequencethenumbers