File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -108,10 +108,10 @@ function Base.iterate(iter::LayoutIterator{<:SFDP}, state)
108
108
end
109
109
end
110
110
if any (isnan, force)
111
- # if two points are at the exact same location
112
- # use random force in any direction
113
- rng = copy ( algo. rng)
114
- force += randn (rng, Ftype)
111
+ # if two points are at the exact same location use random force in any direction
112
+ # copy rng from alg struct to not advance the "initial" rng state
113
+ # otherwise algo(g)== algo(g) might be broken
114
+ force += randn (copy (algo . rng) , Ftype)
115
115
end
116
116
mask = (! ). (pin[i]) # where pin=true mask will multiply with 0
117
117
locs[i] = locs[i] .+ (step .* (force ./ norm (force))) .* mask
Original file line number Diff line number Diff line change @@ -114,8 +114,9 @@ function Base.iterate(iter::LayoutIterator{<:Spring}, state)
114
114
else
115
115
# if two points are at the exact same location
116
116
# use random force in any direction
117
- rng = copy (algo. rng)
118
- force_vec += randn (rng, Ftype)
117
+ # copy rng from alg struct to not advance the "initial" rng state
118
+ # otherwise algo(g)==algo(g) might be broken
119
+ force_vec += randn (copy (algo. rng), Ftype)
119
120
end
120
121
121
122
end
You can’t perform that action at this time.
0 commit comments