131
131
132
132
for turbo in (false , true ), i in 1 : 100
133
133
# Generate a random tree with varying size (1-10 nodes)
134
- n_nodes = rand (1 : 10 )
135
- tree = gen_random_tree_fixed_size (n_nodes, operators, size (X, 1 ), Float64, Node)
134
+ rng = Random. MersenneTwister (i)
135
+ n_nodes = rand (rng, 1 : 10 )
136
+ tree = gen_random_tree_fixed_size (
137
+ n_nodes, operators, size (X, 1 ), Float64, Node, rng
138
+ )
136
139
137
140
# Regular evaluation
138
141
eval_options_no_buffer = EvalOptions (; turbo)
@@ -142,12 +145,12 @@ end
142
145
143
146
# Buffer evaluation
144
147
buffer = Array {Float64} (undef, 2 n_nodes, size (X, 2 ))
145
- buffer_ref = Ref (rand (1 : 10 )) # Random starting index (will be reset)
148
+ buffer_ref = Ref (rand (rng, 1 : 10 )) # Random starting index (will be reset)
146
149
eval_options = EvalOptions (; turbo, buffer= ArrayBuffer (buffer, buffer_ref))
147
150
result2, ok2 = eval_tree_array (tree, X, operators; eval_options)
148
151
149
152
# Results should be identical
150
- @test isapprox (result1, result2; atol= 1e-10 )
153
+ @test isapprox (result1, result2; atol= 1e-10 ) || ( ! ok1 && ! ok2)
151
154
@test ok1 == ok2
152
155
end
153
156
end
0 commit comments