rndgen_mod Module


Used by

  • module~~rndgen_mod~~UsedByGraph module~rndgen_mod rndgen_mod module~rndgenpl_mod rndgenPL_mod module~rndgenpl_mod->module~rndgen_mod

Variables

Type Visibility Attributes Name Initial
integer, private, parameter :: dp = selected_real_kind(15)
integer, private, parameter :: i8 = selected_int_kind(8)
integer, private, parameter :: i16 = selected_int_kind(16)
real(kind=dp), private, parameter :: am = 4.656612873077392578d-10

Derived Types

type, public ::  rndSeed

Random seeds object

Components

Type Visibility Attributes Name Initial
integer(kind=i8), private :: mseed(4)

Type-Bound Procedures

procedure, public :: saveToFile => saveToFile_rndSeed
procedure, public :: readFromFile => readFromFile_rndSeed

type, public ::  rndgen

Random number generator object with its procedures

Components

Type Visibility Attributes Name Initial
integer, public :: o_iseed
type(rndSeed), public :: seed

Type-Bound Procedures

procedure, public :: rnd => rnd_rndgen
procedure, public :: int => int_rndgen
procedure, public :: real => real_rndgen
procedure, public :: init => init_rndgen
procedure, public :: reset => reset_rndgen
procedure, public :: save_seed => save_seed_rndgen
procedure, public :: read_seed => read_seed_rndgen

Functions

private function rnd_rndgen(this) result(rnd_number)

Generates a random number in the range [0, 1)

Arguments

Type IntentOptional Attributes Name
class(rndgen) :: this

Return Value real(kind=dp)

private function int_rndgen(this, i1, i2) result(rnd_number)

Generates a random integer number in the range [i1, i2]

Arguments

Type IntentOptional Attributes Name
class(rndgen) :: this
integer(kind=i16), intent(in) :: i1
integer(kind=i16), intent(in) :: i2

Return Value integer(kind=i16)

private function real_rndgen(this, r1, r2) result(rnd_number)

Generates a random real number in the range [r1, r2)

Arguments

Type IntentOptional Attributes Name
class(rndgen) :: this
real(kind=dp), intent(in) :: r1
real(kind=dp), intent(in) :: r2

Return Value real(kind=dp)


Subroutines

private subroutine init_rndgen(this, iseed)

Initializes the random number generator

Read more…

Arguments

Type IntentOptional Attributes Name
class(rndgen) :: this
integer(kind=i8) :: iseed

private subroutine reset_rndgen(this)

Resets the random number generator

Arguments

Type IntentOptional Attributes Name
class(rndgen) :: this

private subroutine save_seed_rndgen(this, u_mseed, und)

Save the current seeds to a seeds object and, optionally, to a file unit

Arguments

Type IntentOptional Attributes Name
class(rndgen) :: this
type(rndSeed), intent(out) :: u_mseed
integer, intent(in), optional :: und

private subroutine read_seed_rndgen(this, u_mseed, und)

Read the seeds from a seeds object or, optionally, from a file unit

Arguments

Type IntentOptional Attributes Name
class(rndgen) :: this
type(rndSeed), intent(in) :: u_mseed
integer, intent(in), optional :: und

private subroutine saveToFile_rndSeed(this, und)

Save the seeds to a file unit

Arguments

Type IntentOptional Attributes Name
class(rndSeed) :: this
integer, intent(in) :: und

private subroutine readFromFile_rndSeed(this, und)

Read the seeds from a file unit

Arguments

Type IntentOptional Attributes Name
class(rndSeed) :: this
integer, intent(in) :: und