Skip to content

Commit 401eb4a

Browse files
committed
rename randmtzig_exprnd -> randexp
1 parent 53875ee commit 401eb4a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

base/random.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export srand,
77
randn, randn!,
88
randbool,
99
AbstractRNG, RNG, MersenneTwister,
10-
randmtzig_exprnd
10+
randexp
1111

1212
abstract AbstractRNG
1313

@@ -984,23 +984,23 @@ randn(dims::Int...) = randn!(Array(Float64, dims...))
984984
randn(rng::MersenneTwister, dims::Dims) = randn!(rng, Array(Float64, dims))
985985
randn(rng::MersenneTwister, dims::Int...) = randn!(rng, Array(Float64, dims...))
986986

987-
@inline function randmtzig_exprnd(rng::MersenneTwister=GLOBAL_RNG)
987+
@inline function randexp(rng::MersenneTwister=GLOBAL_RNG)
988988
@inbounds begin
989989
ri = rand_ui52(rng)
990990
idx = ri & 0xFF
991991
x = ri*we[idx+1]
992992
ri < ke[idx+1] && return x # 98.9% of the time we return here 1st try
993-
return randmtzig_exprnd_unlikely(rng, idx, x)
993+
return randexp_unlikely(rng, idx, x)
994994
end
995995
end
996996

997-
function randmtzig_exprnd_unlikely(rng, idx, x)
997+
function randexp_unlikely(rng, idx, x)
998998
@inbounds if idx == 0
999999
return ziggurat_exp_r - log(rand(rng))
10001000
elseif (fe[idx] - fe[idx+1])*rand(rng) + fe[idx+1] < exp(-x)
10011001
return x # return from the triangular area
10021002
else
1003-
return randmtzig_exprnd(rng)
1003+
return randexp(rng)
10041004
end
10051005
end
10061006

0 commit comments

Comments
 (0)