diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-11-17 17:50:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-17 17:50:46 +0100 |
commit | e445bacd90688e85d9720353b70814cdbf66e7db (patch) | |
tree | d2fda43c1424cab6a95252f2df93cf1287e23288 | |
parent | 2b246298479ed4726f37d4cf6bc3b995bd333bbd (diff) | |
parent | 9536b3b59a6964b2b9f75fedf5326c8ee4d67503 (diff) |
Merge pull request #55058 from Chaosus/fix_randfn
-rw-r--r-- | modules/visual_script/visual_script_builtin_funcs.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index e6cc25f6bd..7ae85ea415 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -837,15 +837,20 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in case VisualScriptBuiltinFunc::MATH_RANDF: { *r_return = Math::randf(); } break; + case VisualScriptBuiltinFunc::MATH_RANDI_RANGE: { + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + *r_return = Math::random((int)*p_inputs[0], (int)*p_inputs[1]); + } break; case VisualScriptBuiltinFunc::MATH_RANDF_RANGE: { VALIDATE_ARG_NUM(0); VALIDATE_ARG_NUM(1); *r_return = Math::random((double)*p_inputs[0], (double)*p_inputs[1]); } break; - case VisualScriptBuiltinFunc::MATH_RANDI_RANGE: { + case VisualScriptBuiltinFunc::MATH_RANDFN: { VALIDATE_ARG_NUM(0); VALIDATE_ARG_NUM(1); - *r_return = Math::random((int)*p_inputs[0], (int)*p_inputs[1]); + *r_return = Math::randfn((double)*p_inputs[0], (double)*p_inputs[1]); } break; case VisualScriptBuiltinFunc::MATH_SEED: { VALIDATE_ARG_NUM(0); |