From: Ray Strode Date: Mon, 4 Dec 2023 00:06:47 +0000 (-0500) Subject: script: Use new ply_get_random_number function X-Git-Tag: 23.51.283~13^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75d371edeff1ec0f47218a7d5e2f0696950a47e7;p=thirdparty%2Fplymouth.git script: Use new ply_get_random_number function --- 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");