no early return required here

This commit is contained in:
Martin Diehl 2018-02-21 08:55:33 +01:00
parent 051f3592ea
commit 6b1c1af609
1 changed files with 10 additions and 11 deletions

View File

@ -1902,19 +1902,18 @@ real(pReal) function math_sampleGaussVar(meanvalue, stddev, width)
if (abs(stddev) < tol_math_check) then if (abs(stddev) < tol_math_check) then
math_sampleGaussVar = meanvalue math_sampleGaussVar = meanvalue
return else
myWidth = merge(width,3.0_pReal,present(width)) ! use +-3*sigma as default value for scatter if not given
do
call halton(2_pInt, rnd)
scatter = myWidth * (2.0_pReal * rnd(1) - 1.0_pReal)
if (rnd(2) <= exp(-0.5_pReal * scatter ** 2.0_pReal)) exit ! test if scattered value is drawn
enddo
math_sampleGaussVar = scatter * stddev
endif endif
myWidth = merge(width,3.0_pReal,present(width)) ! use +-3*sigma as default value for scatter if not given
do
call halton(2_pInt, rnd)
scatter = myWidth * (2.0_pReal * rnd(1) - 1.0_pReal)
if (rnd(2) <= exp(-0.5_pReal * scatter ** 2.0_pReal)) exit ! test if scattered value is drawn
enddo
math_sampleGaussVar = scatter * stddev
end function math_sampleGaussVar end function math_sampleGaussVar