Skip to content

Commit b85d408

Browse files
committed
update
1 parent 20ea0ce commit b85d408

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/primitives/lebesgue.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ gentype(::Lebesgue) = Float64
4848

4949
Lebesgue() = Lebesgue(ℝ)
5050

51-
testvalue(::Type{T}, d::Lebesgue) where {T} = testvalue(T, d.support)::T
51+
function Base.rand(rng::ConstantRNG, ::Type{T}, d::Lebesgue) where {T}
52+
zero(T)
53+
end
5254

5355
proxy(d::Lebesgue) = restrict(in(d.support), LebesgueBase())
5456
proxy(::Lebesgue{MeasureBase.RealNumbers}) = LebesgueBase()

src/rand.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Base.rand(d::AbstractMeasure) = rand(Random.GLOBAL_RNG, Float64, d)
44

55
Base.rand(T::Type, μ::AbstractMeasure) = rand(Random.GLOBAL_RNG, T, μ)
66

7+
@nospecialize
8+
function Base.rand(rng::AbstractRNG, ::Type{T}, d::M) where {T, M<:AbstractMeasure}
9+
@error "No method defined for rand(::AbstractRNG, ::Type{T}, $M)"
10+
end
11+
@specialize
12+
713
Base.rand(rng::AbstractRNG, d::AbstractMeasure) = rand(rng, Float64, d)
814

915
@inline Random.rand!(d::AbstractMeasure, args...) = rand!(GLOBAL_RNG, d, args...)

0 commit comments

Comments
 (0)