From 8cb7c5b73022a8f824eafdc990009913c408273b Mon Sep 17 00:00:00 2001 From: Hossein Pourbozorg Date: Tue, 7 Nov 2023 02:32:49 +0330 Subject: [PATCH] fix type unstable `Uniform` --- src/univariate/continuous/uniform.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/univariate/continuous/uniform.jl b/src/univariate/continuous/uniform.jl index 1f535159d0..0bb6e875c3 100644 --- a/src/univariate/continuous/uniform.jl +++ b/src/univariate/continuous/uniform.jl @@ -151,7 +151,7 @@ Base.:*(c::Real, d::Uniform) = Uniform(minmax(c * d.a, c * d.b)...) #### Sampling -rand(rng::AbstractRNG, d::Uniform) = d.a + (d.b - d.a) * rand(rng) +rand(rng::AbstractRNG, d::Uniform{T}) where {T<:Real} = d.a + (d.b - d.a) * rand(rng, T) _rand!(rng::AbstractRNG, d::Uniform, A::AbstractArray{<:Real}) = A .= quantile.(d, rand!(rng, A))