rndgen Derived Type

type, public :: rndgen

Random number generator object with its procedures


Inherits

type~~rndgen~~InheritsGraph type~rndgen rndgen type~rndseed rndSeed type~rndgen->type~rndseed seed

Inherited by

type~~rndgen~~InheritedByGraph type~rndgen rndgen type~rndgenpl rndgenPL type~rndgenpl->type~rndgen

Components

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

Type-Bound Procedures

procedure, public :: rnd => rnd_rndgen

  • 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)

procedure, public :: int => int_rndgen

  • 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)

procedure, public :: real => real_rndgen

  • 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)

procedure, public :: init => init_rndgen

  • 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

procedure, public :: reset => reset_rndgen

  • private subroutine reset_rndgen(this)

    Resets the random number generator

    Arguments

    Type IntentOptional Attributes Name
    class(rndgen) :: this

procedure, public :: save_seed => save_seed_rndgen

  • 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

procedure, public :: read_seed => read_seed_rndgen

  • 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