rndgenPL_mod Module


Uses

  • module~~rndgenpl_mod~~UsesGraph module~rndgenpl_mod rndgenPL_mod module~rndgen_kinds_mod rndgen_kinds_mod module~rndgenpl_mod->module~rndgen_kinds_mod module~rndgen_mod rndgen_mod module~rndgenpl_mod->module~rndgen_mod iso_fortran_env iso_fortran_env module~rndgen_kinds_mod->iso_fortran_env module~rndgen_mod->module~rndgen_kinds_mod

Variables

Type Visibility Attributes Name Initial
real(kind=dp), private, parameter :: am = 4.656612873077392578d-10

Derived Types

type, public, extends(rndgen) ::  rndgenPL

Random number generator object for power-law distribution, adapted from Silvio C. Ferreira code. The power-law distribution is given by P(k) = k^(-gamma), where k is an integer between kmin and kmax.

Components

Type Visibility Attributes Name Initial
integer(kind=i4), public :: o_iseed
type(rndSeed), public :: seed
real(kind=dp), private :: AA
real(kind=dp), private :: expo
real(kind=dp), private :: x0
real(kind=dp), private :: xc
real(kind=dp), public :: gamma
integer(kind=i4), public :: kmin
integer(kind=i4), public :: kmax
real(kind=dp), private, allocatable :: prob(:)

Type-Bound Procedures

procedure, public :: rnd => rnd_rndgen_dp
procedure, public :: int => int_rndgen_i4
procedure, public :: int_i4 => int_rndgen_i4
procedure, public :: int_i8 => int_rndgen_i8
procedure, public :: real => real_rndgen_dp
procedure, public :: real_sp => real_rndgen_sp
procedure, public :: init => init_rndgen
procedure, public :: reset => reset_rndgen
procedure, public :: save_seed => save_seed_rndgen
procedure, public :: read_seed => read_seed_rndgen
generic, public :: rnd_array => rnd_array_rnd, rnd_array_real, rnd_array_int_i4
procedure, public :: rnd_array_i4 => rnd_array_int_i4
procedure, public :: rnd_array_i8 => rnd_array_int_i8
procedure, public :: rndPL => rndPL_rndgenPL
procedure, public :: initPL => initPL_rndgenPL
procedure, public :: rndPL_array

Functions

private function rndPL_rndgenPL(this) result(rnd_number)

Generates a random number following the power-law distribution

Arguments

Type IntentOptional Attributes Name
class(rndgenPL) :: this

Return Value integer(kind=i4)

private function rndPL_array(gen, n) result(arr)

Arguments

Type IntentOptional Attributes Name
class(rndgenPL), intent(in) :: gen
integer(kind=i4), intent(in) :: n

Return Value integer(kind=i4), allocatable, (:)


Subroutines

private subroutine initPL_rndgenPL(this, kmin, kmax, gama, iseed)

Initializes the power-law random number generator

Arguments

Type IntentOptional Attributes Name
class(rndgenPL) :: this
integer(kind=i4), intent(in) :: kmin
integer(kind=i4), intent(in) :: kmax
real(kind=dp), intent(in) :: gama
integer, intent(in), optional :: iseed