rng_init Subroutine

public subroutine rng_init(self, seed)

Uses

  • proc~~rng_init~~UsesGraph proc~rng_init rng_init module~mpi_utils mpi_utils proc~rng_init->module~mpi_utils

Procedure to initialize a random number generator with a seed. If seed is negative then random seed is used

Arguments

Type IntentOptional AttributesName
type(rng_type), intent(inout) :: self

Random Number Generator

integer(kind=Int32), intent(in) :: seed

Initial Seed Value


Calls

proc~~rng_init~~CallsGraph proc~rng_init rng_init proc~rng_seed rng_seed proc~rng_init->proc~rng_seed proc~my_rank my_rank proc~rng_init->proc~my_rank

Called by

proc~~rng_init~~CalledByGraph proc~rng_init rng_init proc~get_nlaunch get_nlaunch proc~get_nlaunch->proc~rng_init proc~get_nlaunch_pass_grid get_nlaunch_pass_grid proc~get_nlaunch_pass_grid->proc~rng_init proc~pnpa_f pnpa_f proc~pnpa_f->proc~get_nlaunch_pass_grid proc~dcx dcx proc~dcx->proc~get_nlaunch proc~fida_weights_mc fida_weights_mc proc~fida_weights_mc->proc~get_nlaunch proc~fida_f fida_f proc~fida_f->proc~get_nlaunch proc~npa_f npa_f proc~npa_f->proc~get_nlaunch proc~halo halo proc~halo->proc~get_nlaunch proc~pfida_f pfida_f proc~pfida_f->proc~get_nlaunch_pass_grid program~fidasim fidasim program~fidasim->proc~pnpa_f program~fidasim->proc~dcx program~fidasim->proc~fida_weights_mc program~fidasim->proc~fida_f program~fidasim->proc~npa_f program~fidasim->proc~halo program~fidasim->proc~pfida_f

Contents

Source Code


Source Code

subroutine rng_init(self, seed)
#ifdef _MPI
    use mpi_utils
#endif

    !+ Procedure to initialize a random number generator with a seed.
    !+ If seed is negative then random seed is used
    type(rng_type), intent(inout) :: self
        !+ Random Number Generator
    integer(Int32), intent(in)    :: seed
        !+ Initial Seed Value

    integer(Int32) :: s

    if(seed.lt.0) then
        s = rng_seed()
    else
#ifdef _MPI
        s = seed + my_rank()
#else
        s = seed
#endif
    endif


    self%seed = s
    self%state(1) = ieor(777755555,abs(s))
    self%state(2) = ior(ieor(888889999,abs(s)),1)

end subroutine rng_init