genrand_real2_dSFMT Function

public function genrand_real2_dSFMT() result(r)

Arguments

None

Return Value real(kind=dp)


Contents

Source Code


Source Code

    function genrand_real2_dSFMT() result(r)

        ! Return:
        !    random number in interval [0,1).  Name comes from the function
        !    defined in the original Mersenne Twist implementation.

        real(dp) :: r

        if (current_element == random_store_size+1) then
            ! Run out of random numbers: get more.
            current_element = 1
            call fill_array_close_open_fwrapper(random_store, &
                                                int(random_store_size, c_int))
        end if

        r = random_store(current_element)
        current_element = current_element + 1

    end function genrand_real2_dSFMT