Skip to content

Commit

Permalink
Merge pull request #3608 from JuliaReach/schillic/Tetrahedron_rand
Browse files Browse the repository at this point in the history
Make `rand` of `Tetrahedron` consistent
  • Loading branch information
schillic authored Jul 23, 2024
2 parents 1c2b91b + 2be3e09 commit afc5ee8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Sets/Tetrahedron/TetrahedronModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ using ..LazySets: AbstractPolytope
using LinearAlgebra: dot, cross
using Random: AbstractRNG, GLOBAL_RNG
using ReachabilityBase.Comparison: isapproxzero
using ReachabilityBase.Distribution: reseed!
using ReachabilityBase.Require: require

@reexport import ..API: constraints_list, dim, isoperationtype, rand, , σ
Expand Down
9 changes: 5 additions & 4 deletions src/Sets/Tetrahedron/rand.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
function rand(::Type{Tetrahedron}; N::Type{<:Real}=Float64, rng::AbstractRNG=GLOBAL_RNG,
seed::Union{Int,Nothing}=nothing)
function rand(::Type{Tetrahedron}; N::Type{<:Real}=Float64, dim::Int=3,
rng::AbstractRNG=GLOBAL_RNG, seed::Union{Int,Nothing}=nothing)
@assert dim == 3 "cannot create a random Tetrahedron of dimension $dim"
require(@__MODULE__, :LazySets; fun_name="rand")

rng = reseed!(rng, seed)
P = rand(VPolytope; N=N, dim=3, rng=rng, seed=seed, num_vertices=4)
vertices = P.vertices
return Tetrahedron(vertices)
return Tetrahedron(P.vertices)
end

0 comments on commit afc5ee8

Please sign in to comment.