Skip to content

Infinite loop in truncated normal distribution #1712

Open
@danielmatz

Description

@danielmatz

Using Distributions v0.25.87, the following results in an infinite loop:

julia> d = Normal(204.764679086758, 0.0)
Normal{Float64}=204.764679086758, σ=0.0)

julia> rand(d)
204.764679086758

julia> d2 = truncated(d, 204.764679086758, 204.764679086758)
Truncated(Normal{Float64}=204.764679086758, σ=0.0); lower=204.764679086758, upper=204.764679086758)

julia> rand(d2)
# hangs

Perhaps setting standard deviation to 0.0 is an odd thing to do, but I was expecting it to just return 204.764679086758 on all calls to rand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions