From 75d371edeff1ec0f47218a7d5e2f0696950a47e7 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Sun, 3 Dec 2023 19:06:47 -0500 Subject: [PATCH] script: Use new ply_get_random_number function --- src/plugins/splash/script/script-lib-math.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/splash/script/script-lib-math.c b/src/plugins/splash/script/script-lib-math.c index be8eec97..292aa6d4 100644 --- a/src/plugins/splash/script/script-lib-math.c +++ b/src/plugins/splash/script/script-lib-math.c @@ -29,6 +29,7 @@ #include "script-object.h" #include "script-lib-math.h" #include +#include #include #include #include @@ -60,7 +61,7 @@ static script_return_t script_lib_math_double_from_double_double_function (scrip static script_return_t script_lib_math_random (script_state_t *state, void *user_data) { - double reply_double = random () / ((double) RAND_MAX + 1); + double reply_double = ply_get_random_number (0, LONG_MAX) / ((double) LONG_MAX); return script_return_obj (script_obj_new_number (reply_double)); } @@ -69,7 +70,6 @@ script_lib_math_data_t *script_lib_math_setup (script_state_t *state) { script_lib_math_data_t *data = malloc (sizeof(script_lib_math_data_t)); - srand ((int) ply_get_timestamp ()); script_obj_t *math_hash = script_obj_hash_get_element (state->global, "Math"); -- 2.47.3