rndgenPL_mod Module


Uses

  • module~~rndgenpl_mod~~UsesGraph module~rndgenpl_mod rndgenPL_mod module~rndgen_mod rndgen_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, 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, 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=i16), public :: kmin
integer(kind=i16), public :: kmax
real(kind=dp), private, allocatable :: prob(:)

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
procedure, public :: rndPL => rndPL_rndgenPL
procedure, public :: initPL => initPL_rndgenPL

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=i16)


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=i16), intent(in) :: kmin
integer(kind=i16), intent(in) :: kmax
real(kind=dp), intent(in) :: gama
integer, intent(in), optional :: iseed