diff --git a/tests/run_all_unitary_tests.m b/tests/run_all_unitary_tests.m
index c7d09104d7dbeb975180ce7d19cbb1d105aa4a2b..c8d65b4fc07382b78d52e384f4c5a1a2ab499964 100644
--- a/tests/run_all_unitary_tests.m
+++ b/tests/run_all_unitary_tests.m
@@ -1,4 +1,4 @@
-% Copyright © 2013-2020 Dynare Team
+% Copyright © 2013-2022 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -39,7 +39,7 @@ if isoctave
 end
 
 % Set random seed, for reproducibility
-if isoctave
+if isoctave && octave_ver_less_than('7')
     randn('state',1);
     rand('state',1);
 else