RandomClass Module



Contents


Interfaces

public interface randi

  • public function randi_range_rank2(valrange, size1, size2) result(ret)

    Arguments

    Type IntentOptional AttributesName
    integer(kind=int32), intent(in) :: valrange(2)
    integer(kind=int32), intent(in) :: size1
    integer(kind=int32), intent(in) :: size2

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

  • public function randi_imax(imax) result(ret)

    Arguments

    Type IntentOptional AttributesName
    integer(kind=int32), intent(in) :: imax

    Return Value integer(kind=int32)

  • public function randi_imax_n(imax, n) result(ret)

    Arguments

    Type IntentOptional AttributesName
    integer(kind=int32), intent(in) :: imax
    integer(kind=int32), intent(in) :: n

    Return Value integer(kind=int32) (n)

public interface rand

  • public function rand_n(n) result(ret)

    Arguments

    Type IntentOptional AttributesName
    integer(kind=int32), intent(in) :: n

    Return Value real(kind=real64) (n)

  • public function rand_sz2(sz1, sz2) result(ret)

    Arguments

    Type IntentOptional AttributesName
    integer(kind=int32), intent(in) :: sz1
    integer(kind=int32), intent(in) :: sz2

    Return Value real(kind=real64) (sz1,sz2)

  • public function rand_sz3(sz1, sz2, sz3) result(ret)

    Arguments

    Type IntentOptional AttributesName
    integer(kind=int32), intent(in) :: sz1
    integer(kind=int32), intent(in) :: sz2
    integer(kind=int32), intent(in) :: sz3

    Return Value real(kind=real64) (sz1,sz2,sz3)


Derived Types

type, public :: Random_

Components

TypeVisibility AttributesNameInitial
integer(kind=int32), public :: random_int
integer(kind=int32), public, allocatable:: random_int_seed(:)
integer(kind=int32), public, allocatable:: random_int_vec(:)
real(kind=real64), public :: random_real
real(kind=real64), public, allocatable:: random_real_vec(:)

Type-Bound Procedures

procedure, public :: init => initRandom
procedure, public :: random => getRandom
procedure, public :: randint => getRandomInt
procedure, public :: name => nameRandom
procedure, public :: choiceInt => choiceRandomInt
procedure, public :: choiceReal => choiceRandomReal
procedure, public :: uniform => uniformRandom
procedure, public :: gauss => gaussRandom
procedure, public :: ChiSquared => ChiSquaredRandom
procedure, public :: Chauchy => ChauchyRandom
procedure, public :: Lognormal => LognormalRandom
procedure, public :: InverseGauss => InverseGaussRandom
procedure, public :: save => saveRandom
procedure, public, pass :: randnRandomVector
procedure, public, pass :: randnRandomArray
generic, public :: randn => randnRandomArray, randnRandomVector
procedure, public :: fill => fillRandom
procedure, public :: histogram => histogramRandom
procedure, public :: scalar => scalarRandom
procedure, public :: vector => vectorRandom
procedure, public :: matrix => matrixRandom
procedure, public :: cube => cubeRandom

Functions

public function getRandom(obj, distribution) result(x)

Arguments

Type IntentOptional AttributesName
class(Random_) :: obj
character(len=*), intent(in), optional :: distribution

Return Value real(kind=real64)

public function uniformRandom(obj, From, To) result(x)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(in) :: obj
real(kind=real64), intent(in) :: From
real(kind=real64), intent(in) :: To

Return Value real(kind=real64)

public function getRandomInt(obj, From, To) result(x)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(in) :: obj
integer(kind=int32), intent(in) :: From
integer(kind=int32), intent(in) :: To

Return Value integer(kind=int32)

public function choiceRandomInt(obj, Vector, Array) result(val)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(in) :: obj
integer(kind=int32), intent(in), optional :: Vector(:)
integer(kind=int32), intent(in), optional :: Array(:,:)

Return Value integer(kind=int32)

public function choiceRandomReal(obj, Vector, Array) result(val)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(in) :: obj
real(kind=real64), intent(in), optional :: Vector(:)
real(kind=real64), intent(in), optional :: Array(:,:)

Return Value real(kind=real64)

public function randnRandomArray(obj, d0, d1) result(array)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj
integer(kind=int32), intent(in) :: d0
integer(kind=int32), intent(in) :: d1

Return Value real(kind=real64), allocatable, (:,:)

public function randnRandomVector(obj, d0) result(array)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj
integer(kind=int32), intent(in) :: d0

Return Value real(kind=real64), allocatable, (:)

public function histogramRandom(obj, list, division) result(histogram)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj
real(kind=real64), intent(in) :: list(:)
integer(kind=int32), intent(in), optional :: division

Return Value real(kind=real64), allocatable, (:,:)

public function nameRandom(obj) result(str)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj

Return Value character(len=200)

public function gaussRandom(obj, mu, sigma) result(ret)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj
real(kind=real64), intent(in) :: mu
real(kind=real64), intent(in) :: sigma

Return Value real(kind=real64)

public function ChiSquaredRandom(obj, k) result(ret)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj
real(kind=real64), intent(in) :: k

Return Value real(kind=real64)

public function ChauchyRandom(obj, mu, gamma) result(ret)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj
real(kind=real64), intent(in) :: mu
real(kind=real64), intent(in) :: gamma

Return Value real(kind=real64)

public function LognormalRandom(obj, mu, sigma) result(ret)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj
real(kind=real64), intent(in) :: mu
real(kind=real64), intent(in) :: sigma

Return Value real(kind=real64)

public function InverseGaussRandom(obj, mu, lambda) result(ret)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj
real(kind=real64), intent(in) :: mu
real(kind=real64), intent(in) :: lambda

Return Value real(kind=real64)

public function cubeRandom(obj, size1, size2, size3) result(ret)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj
integer(kind=int32), intent(in) :: size1
integer(kind=int32), intent(in) :: size2
integer(kind=int32), intent(in) :: size3

Return Value real(kind=real64), allocatable, (:,:,:)

public function matrixRandom(obj, size1, size2) result(ret)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj
integer(kind=int32), intent(in) :: size1
integer(kind=int32), intent(in) :: size2

Return Value real(kind=real64), allocatable, (:,:)

public function vectorRandom(obj, size1) result(ret)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj
integer(kind=int32), intent(in) :: size1

Return Value real(kind=real64), allocatable, (:)

public function scalarRandom(obj, size1) result(ret)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj
integer(kind=int32), intent(in) :: size1

Return Value real(kind=real64), allocatable

public function randi_range_rank2(valrange, size1, size2) result(ret)

Arguments

Type IntentOptional AttributesName
integer(kind=int32), intent(in) :: valrange(2)
integer(kind=int32), intent(in) :: size1
integer(kind=int32), intent(in) :: size2

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

public function randi_imax(imax) result(ret)

Arguments

Type IntentOptional AttributesName
integer(kind=int32), intent(in) :: imax

Return Value integer(kind=int32)

public function randi_imax_n(imax, n) result(ret)

Arguments

Type IntentOptional AttributesName
integer(kind=int32), intent(in) :: imax
integer(kind=int32), intent(in) :: n

Return Value integer(kind=int32) (n)

public function rand_n(n) result(ret)

Arguments

Type IntentOptional AttributesName
integer(kind=int32), intent(in) :: n

Return Value real(kind=real64) (n)

public function rand_sz2(sz1, sz2) result(ret)

Arguments

Type IntentOptional AttributesName
integer(kind=int32), intent(in) :: sz1
integer(kind=int32), intent(in) :: sz2

Return Value real(kind=real64) (sz1,sz2)

public function rand_sz3(sz1, sz2, sz3) result(ret)

Arguments

Type IntentOptional AttributesName
integer(kind=int32), intent(in) :: sz1
integer(kind=int32), intent(in) :: sz2
integer(kind=int32), intent(in) :: sz3

Return Value real(kind=real64) (sz1,sz2,sz3)


Subroutines

public subroutine initRandom(obj)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj

public subroutine saveRandom(obj)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj

public subroutine fillRandom(obj, array, vector)

Arguments

Type IntentOptional AttributesName
class(Random_), intent(inout) :: obj
real(kind=real64), intent(inout), optional :: array(:,:)
real(kind=real64), intent(inout), optional :: vector(:)