From 58a01419fcbdf6956624966ccb15f6f02a43b149 Mon Sep 17 00:00:00 2001 From: Pengfei Jia Date: Tue, 7 Feb 2023 12:17:31 -0500 Subject: [PATCH] Fixing random number generator function parser --- source/base/mu_parser_internal.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/base/mu_parser_internal.cc b/source/base/mu_parser_internal.cc index 463d5a5287..eb3173f5cb 100644 --- a/source/base/mu_parser_internal.cc +++ b/source/base/mu_parser_internal.cc @@ -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 { -- 2.39.5