From: Ray Strode Date: Fri, 8 Jun 2012 20:52:29 +0000 (-0400) Subject: script: seed random number generator X-Git-Tag: 0.8.6~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f8bd998dcc6d592ffd5d3aefad06f0bbf28a725;p=thirdparty%2Fplymouth.git script: seed random number generator Most splash plugins that use random numbers seed the random number generator with the current time, but script fails, too. This commit fixes that. https://bugs.freedesktop.org/show_bug.cgi?id=42632 --- diff --git a/src/plugins/splash/script/script-lib-math.c b/src/plugins/splash/script/script-lib-math.c index 383fe46f..a1afc041 100644 --- a/src/plugins/splash/script/script-lib-math.c +++ b/src/plugins/splash/script/script-lib-math.c @@ -65,6 +65,8 @@ 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"); script_add_native_function (math_hash, "Cos",