Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RNG to push function #65

Merged
merged 2 commits into from
Apr 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/VoronoiDelaunay.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import GeometricalPredicates: geta, getb, getc

import Base: push!, iterate, copy, sizehint!
import Colors: RGB, RGBA
using Random: shuffle!
using Random: shuffle!, MersenneTwister

const min_coord = GeometricalPredicates.min_coord + eps(Float64)
const max_coord = GeometricalPredicates.max_coord - eps(Float64)
Expand Down Expand Up @@ -703,8 +703,8 @@ function _pushunsorted!(tess::DelaunayTessellation2D{T}, a::Vector{T}) where {T<
end

# push an array but sort it first for better performance
function push!(tess::DelaunayTessellation2D{T}, a::Vector{T}) where {T<:AbstractPoint2D}
shuffle!(a)
function push!(tess::DelaunayTessellation2D{T}, a::Vector{T}, rng = MersenneTwister()) where {T<:AbstractPoint2D}
shuffle!(rng, a)
mssort!(a)
_pushunsorted!(tess, a)
end
Expand Down