Skip to content

Commit 28c0186

Browse files
committed
Use randexp
1 parent ef49c73 commit 28c0186

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mh-core.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,11 @@ function AbstractMCMC.step!(
192192
params = propose(spl, model, params_prev)
193193

194194
# Calculate the log acceptance probability.
195-
α = logdensity(model, params) - logdensity(model, params_prev) +
195+
logα = logdensity(model, params) - logdensity(model, params_prev) +
196196
q(spl, params_prev, params) - q(spl, params, params_prev)
197197

198198
# Decide whether to return the previous params or the new one.
199-
if log(rand(rng)) < min(0.0, α)
199+
if -Random.randexp(rng) < logα
200200
return params
201201
else
202202
return params_prev

0 commit comments

Comments
 (0)