Skip to content

Edge case for truncated #1975

@nicomignoni

Description

@nicomignoni

Hi!
While using Distributions.jl (v. 0.25.118), I stumbled on this possible corner case

using Distributions

n = truncated(Normal(0, 0), lower=0)
rand(n, 10)

which does not seem to terminate. I think the expected behaviour should be a Vector of 0.

It behaves similarly for (it seems any) lower >= 0, while it works for lower < 0. Could it be that truncated does not check if the distributions can produce a sample within the lower and upper bounds?

Unless I'm mistaken, this occurs only when the distribution to be truncated degenerates into a Dirac distribution. I don't know if it is worth adding a fix to this; in my case, it occurred while constructing distributions for photovoltaic generation data: I have a bunch of null generation values for dawn hours in my dataset, which generated the described bug.

Thank you!

Best,
Nico

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