rng_uniform Function

public function rng_uniform(self) result(u)

Generate a uniformally-distributed random number in the range [0,1)

Arguments

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

Random Number Generator

Return Value real(kind=Float64)

Uniform random deviate


Called by

proc~~rng_uniform~~CalledByGraph proc~rng_uniform rng_uniform proc~rng_normal rng_normal proc~rng_normal->proc~rng_uniform proc~randu randu proc~randu->proc~rng_uniform proc~mc_halo mc_halo proc~mc_halo->proc~randu proc~randn randn proc~mc_halo->proc~randn proc~bremsstrahlung bremsstrahlung proc~bremsstrahlung->proc~randu proc~fida_weights_mc fida_weights_mc proc~fida_weights_mc->proc~randu proc~gyro_correction gyro_correction proc~fida_weights_mc->proc~gyro_correction proc~ndmc ndmc proc~ndmc->proc~randu proc~mc_nbi mc_nbi proc~ndmc->proc~mc_nbi proc~mc_nbi->proc~randu proc~mc_nbi->proc~randn proc~gyro_correction->proc~randu proc~read_chords read_chords proc~read_chords->proc~randu proc~npa_mc npa_mc proc~npa_mc->proc~randu proc~mc_fastion mc_fastion proc~mc_fastion->proc~randu proc~randn->proc~rng_normal proc~fida_mc fida_mc proc~fida_mc->proc~randu proc~fida_mc->proc~gyro_correction proc~dcx dcx proc~dcx->proc~mc_halo proc~fida_f fida_f proc~fida_f->proc~gyro_correction proc~fida_f->proc~mc_fastion proc~neutron_mc neutron_mc proc~neutron_mc->proc~gyro_correction proc~npa_f npa_f proc~npa_f->proc~mc_fastion proc~halo halo proc~halo->proc~mc_halo program~fidasim fidasim program~fidasim->proc~bremsstrahlung program~fidasim->proc~fida_weights_mc program~fidasim->proc~ndmc program~fidasim->proc~read_chords program~fidasim->proc~npa_mc program~fidasim->proc~fida_mc program~fidasim->proc~dcx program~fidasim->proc~fida_f program~fidasim->proc~neutron_mc program~fidasim->proc~npa_f program~fidasim->proc~halo proc~neutron_f neutron_f program~fidasim->proc~neutron_f proc~neutron_f->proc~gyro_correction

Contents

Source Code


Source Code

function rng_uniform(self) result(u)
    !+ Generate a uniformally-distributed random number in the range [0,1)
    type(rng_type), intent(inout) :: self
        !+ Random Number Generator
    real(Float64)                 :: u
        !+ Uniform random deviate

    integer(Int32) :: ix,iy,k

    ix = self%state(1)
    iy = self%state(2)

    ix = ieor(ix,ishft(ix,13))
    ix = ieor(ix,ishft(ix,-17))
    ix = ieor(ix,ishft(ix,5))
    k=iy/IQ
    iy=IA*(iy - k*IQ) - IR*k
    if(iy.lt.0) iy = iy + IM
    self%state(1) = ix
    self%state(2) = iy

    u = am*ior(iand(IM,ieor(ix,iy)),1)

end function rng_uniform