Skip to content

Commit cbf541b

Browse files
committed
help random_fusion in while loop
1 parent 7a16987 commit cbf541b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

test/setup.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ function random_fusion(I::Type{<:Sector}, ::Val{N}) where {N} # for fusion tree
8080
N == 1 && return (randsector(I),)
8181
tail = random_fusion(I, Val(N - 1))
8282
s = randsector(I)
83-
while isempty((s, first(tail)))
84-
s = randsector(I)
83+
counter = 0
84+
while isempty((s, first(tail))) && counter < 20
85+
counter += 1
86+
s = (counter < 20) ? randsector(I) : leftunit(first(tail))
8587
end
8688
return (s, tail...)
8789
end

0 commit comments

Comments
 (0)