Closed mrakgr closed 3 years ago
using Omega
using Random
function x_(rng)
if bernoulli(rng, 0.5, Bool)::Bool
normal(rng, 0.0, 1.0)::Float64
else bernoulli(rng, 0.5, Bool)
betarv(rng, 2.0, 2.0)::Float64
end
end
x_(Random.GLOBAL_RNG)
ERROR: MethodError: no method matching bernoulli(::MersenneTwister, ::Float64, ::Type{Bool})
Closest candidates are:
bernoulli(::Real, ::Real, ::Type{RT}) where RT at C:\Users\Marko\.julia\packages\Omega\zOdli\src\primitive\univariate.jl:26
bernoulli(::Ω, ::Real, ::Any) at C:\Users\Marko\.julia\packages\Omega\zOdli\src\primitive\univariate.jl:28
bernoulli(::Ω, ::Any, ::Any) at C:\Users\Marko\.julia\packages\Omega\zOdli\src\primitive\univariate.jl:29
...
Stacktrace:
[1] x_(::MersenneTwister) at e:\ProbProg in Julia\01-Omega\tutorial.jl:5
[2] top-level scope at none:0
Actually, it might be better to defer my earlier fix until we can figure out what is going on here. It does not seem that the prob distributions accept the MersenneTwister
from the Random
package. I am just following the tutorial as I go along.
I am new to Julia so I do not know if the example is merely out of date, but to get this to work I had to import the
Random
package explicitly.Random
doesn't seem to be inBase
.