]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fixing random number generator function parser
authorPengfei Jia <pengfej@clemson.edu>
Tue, 7 Feb 2023 17:17:31 +0000 (12:17 -0500)
committerPengfei Jia <pengfej@clemson.edu>
Tue, 7 Feb 2023 17:17:31 +0000 (12:17 -0500)
source/base/mu_parser_internal.cc

index 463d5a5287efe569026ba23848e9bfa5bfa689c1..eb3173f5cbca473db71eed1d8df627feead96765 100644 (file)
@@ -308,8 +308,10 @@ namespace internal
           parser.DefineFun("log", mu_log, true);
           parser.DefineFun("pow", mu_pow, true);
           parser.DefineFun("erfc", mu_erfc, true);
-          parser.DefineFun("rand_seed", mu_rand_seed, true);
-          parser.DefineFun("rand", mu_rand, true);
+          // We need to set optimized=false, because rand will generate
+          // different number every time.
+          parser.DefineFun("rand_seed", mu_rand_seed, false);
+          parser.DefineFun("rand", mu_rand, false);
 
           try
             {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.