Skip to content

Commit

Permalink
Fix random formula generation
Browse files Browse the repository at this point in the history
  • Loading branch information
giopaglia committed Jul 19, 2023
1 parent a24a2dd commit b5a6edc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/random.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ function randformula(
nonmodal_operators = findall(!ismodal, operators)

function _randformula(
rng::AbstractRNG,
height::Integer,
modaldepth::Integer
)::SyntaxTree
Expand All @@ -239,7 +240,7 @@ function randformula(
# op = rand(rng, ops)
op = sample(rng, ops, ops_w)
ch = Tuple([
_randformula(height-1, modaldepth-(ismodal(op) ? 1 : 0))
_randformula(rng, height-1, modaldepth-(ismodal(op) ? 1 : 0))
for _ in 1:arity(op)])
return SyntaxTree(op, ch)
end
Expand All @@ -251,23 +252,23 @@ function randformula(
"(infinite) alphabet of type $(typeof(alphabet))!"
end

return _randformula(height, modaldepth)
return _randformula(rng, height, modaldepth)
end

function randbaseformula(
rng::AbstractRNG,
args...;
kwargs...
)
randbaseformula(args...; rng = Random.GLOBAL_RNG, kwargs...)
randbaseformula(args...; rng = rng, kwargs...)
end

function randformula(
rng::AbstractRNG,
args...;
kwargs...
)
randformula(args...; rng = Random.GLOBAL_RNG, kwargs...)
randformula(args...; rng = rng, kwargs...)
end

#= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Kripke Structures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ =#
Expand Down

0 comments on commit b5a6edc

Please sign in to comment.