Skip to content

Commit c2c46a8

Browse files
committed
fix: infinite return value
1 parent 6776f1a commit c2c46a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/AlphaStableDistributions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ function Base.rand(rng::AbstractRNG, d::AlphaStable{T}) where {T<:AbstractFloat}
300300
if α == one(T) && β == zero(T)
301301
return loc + sc * tan(ϕ)
302302
end
303-
w = -log(rand(rng, T))
303+
w = randexp(rng) # exponential random variable with mean 1
304304
α == 2 && (return loc + 2*sc*sqrt(w)*sin(ϕ))
305305
β == zero(T) && (return loc + sc * ((cos((one(T)-α)*ϕ) / w)^(one(T)/α - one(T)) * sin* ϕ) / cos(ϕ)^(one(T)/α)))
306306
cosϕ = cos(ϕ)

0 commit comments

Comments
 (0)